summaryrefslogtreecommitdiff
path: root/Models/Author.cs
blob: fc5d103270783d3dc309d20964d0df0ba2a446c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System.ComponentModel.DataAnnotations;

namespace LibraryAPI.Models {
    public class Author {
        public long Id { get; set; }
        public List<Book>? Books { get; set; }
        [Required]
        public string? Country { get; set; }
        [Required]
        [StringLength(64, ErrorMessage = "Name too long")]
        public string? Name { get; set; }
        [Required]
        [Range(0, 2020, ErrorMessage = "Year out of valid range")]
        public int YearOfBirth { get; set; }
        [Required]
        public string[]? languages { get; set; }
    }
}