using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.AspNetCore.Mvc.ModelBinding; namespace UnicornStore.Models { public class Blessing { [ScaffoldColumn(false)] public int BlessingId { get; set; } public int GenreId { get; set; } public int UnicornId { get; set; } [Required] [StringLength(160, MinimumLength = 2)] public string Title { get; set; } [Required] [Range(0.01, 100.00)] [DataType(DataType.Currency)] [Column(TypeName = "decimal(18,2)")] public decimal Price { get; set; } [Display(Name = "Blessing Art URL")] [StringLength(1024)] public string BlessingArtUrl { get; set; } public virtual Genre Genre { get; set; } public virtual Unicorn Unicorn { get; set; } public virtual List OrderDetails { get; set; } [ScaffoldColumn(false)] [BindNever] [Required] public DateTime Created { get; set; } /// /// TODO: Temporary hack to populate the orderdetails until EF does this automatically. /// public Blessing() { OrderDetails = new List(); Created = DateTime.UtcNow; } } }