summaryrefslogtreecommitdiff
path: root/Models/Book.cs
blob: 49bd527693dbcf7a8573d011edd7edc2991ab951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System.ComponentModel.DataAnnotations;
using LibraryAPI.Validators;

namespace LibraryAPI.Models {
    public class Book {
        public long Id { get; set; }
        [Required]
        public long AuthorId { get; set; }
        public Author? Author { get; set; }
        [Required]
        public int PublicationYear { get; set; }
        [Required]
        public string[]? Genres { get; set; }
        public int Edition { get; set; }
        [Required]
        [ISBN(13)]
        public string? ISBN { get; set; }
        [Required]
        [StringLength(128, ErrorMessage = "Title too long")]
        public string? Title { get; set; }
    }
}