diff --git a/NorthwindCRUD/Models/Contracts/IProduct.cs b/NorthwindCRUD/Models/Contracts/IProduct.cs index 072cbc8..b2e5b1a 100644 --- a/NorthwindCRUD/Models/Contracts/IProduct.cs +++ b/NorthwindCRUD/Models/Contracts/IProduct.cs @@ -4,6 +4,8 @@ public interface IProduct { int ProductId { get; set; } + string ProductName { get; set; } + int? SupplierId { get; set; } int? CategoryId { get; set; } diff --git a/NorthwindCRUD/Models/DbModels/ProductDb.cs b/NorthwindCRUD/Models/DbModels/ProductDb.cs index 9cab5d4..828bb82 100644 --- a/NorthwindCRUD/Models/DbModels/ProductDb.cs +++ b/NorthwindCRUD/Models/DbModels/ProductDb.cs @@ -10,6 +10,9 @@ public class ProductDb : IProduct [DatabaseGenerated(DatabaseGeneratedOption.None)] public int ProductId { get; set; } + [MaxLength(40)] + public string ProductName { get; set; } + public int? SupplierId { get; set; } public SupplierDb? Supplier { get; set; } diff --git a/NorthwindCRUD/Models/Dtos/ProductDto.cs b/NorthwindCRUD/Models/Dtos/ProductDto.cs index 98be8ee..d228d28 100644 --- a/NorthwindCRUD/Models/Dtos/ProductDto.cs +++ b/NorthwindCRUD/Models/Dtos/ProductDto.cs @@ -7,6 +7,9 @@ public class ProductDto : IProduct { public int ProductId { get; set; } + [StringLength(40, ErrorMessage = "ProductName cannot exceed 40 characters.")] + public string ProductName { get; set; } + [Range(1, int.MaxValue, ErrorMessage = "SupplierId must be a valid supplier ID.")] public int? SupplierId { get; set; }