This repository has been archived on 2023-10-28. You can view files and clone it, but cannot push or open issues or pull requests.
pwt-0x01-ng/Models/Product.cs
surtur 0dfead8388
All checks were successful
continuous-integration/drone/push Build is passing
deprecate Product in favour of SimilarProduct
2021-02-16 16:30:45 +01:00

32 lines
849 B
C#

using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using pwt_0x01_ng.Models.Validation;
namespace pwt_0x01_ng.Models
{
[Table("Product")]
public class Product : Entity
{
[Required]
public string Name { get; set; }
[Required]
public int Price { get; set; }
[Required]
public string Description { get; set; }
[FileTypeAttr("image")]
[NotMapped]
public IFormFile Image { get; set; }
[StringLength(255)]
public string ImageSrc { get; set; }
[Required]
[StringLength(50, ErrorMessage = "{0} length must be between {2} and {1}.", MinimumLength = 1)]
public string ImageAlt { get; set; }
[NotMapped]
public IList<SimilarProduct> Similar { get; set; }
[NotMapped]
public bool Selected { get; set; }
}
}