using System; using System.Collections.Generic; using Sockeye.Biz; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; namespace Sockeye.Models { //https://stackoverflow.com/questions/46517584/how-to-add-a-parent-record-with-its-children-records-in-ef-core#46615455 public class SubscriptionItem : ICoreBizObjectModel { public long Id { get; set; } public uint Concurrency { get; set; } [Required] public long SubscriptionId { get; set; } public bool Active { get; set; } [Required] public long ProductId { get; set; } [Required] public DateTime ExpireDate { get; set; } [Required] public int Quantity { get; set; } = 1; [Required] public string OriginalOrderNumber { get; set; }//first order number for ref [Required] public DateTime OriginalOrderDate { get; set; } public bool Renewal { get; set; } [NotMapped] public decimal RenewPriceViz { get; set; } = 0; [NotMapped] public decimal InitialPriceViz { get; set; } = 0; [NotMapped] public string ProductViz { get; set; } [NotMapped] public string CustomerViz { get; set; } [NotMapped] public string CustomerEmailViz { get; set; } [NotMapped] public string SubscriptionEmailViz { get; set; } public List Tags { get; set; } = new List(); //workaround for notification [NotMapped, JsonIgnore] public string Name { get; set; } [JsonIgnore] public Subscription Subscription { get; set; } [NotMapped, JsonIgnore] public SockType SType { get => SockType.SubscriptionItem; } }//eoc }//eons