From f4f9762085b9858eacd7906188841e06e20a893a Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Tue, 20 Sep 2022 20:22:18 -0500 Subject: AƱadidos validadores MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Models/Book.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Models/Book.cs') diff --git a/Models/Book.cs b/Models/Book.cs index 29faa97..49bd527 100644 --- a/Models/Book.cs +++ b/Models/Book.cs @@ -1,12 +1,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; } } } \ No newline at end of file -- cgit v1.2.3