This commit is contained in:
@@ -65,6 +65,10 @@ namespace Sockeye.Models
|
||||
public virtual DbSet<GZCase> GZCase { get; set; }
|
||||
public virtual DbSet<SubscriptionServer> SubscriptionServer { get; set; }
|
||||
|
||||
|
||||
public virtual DbSet<Subscription> Subscription { get; set; }
|
||||
public virtual DbSet<SubscriptionItem> SubscriptionItem { get; set; }
|
||||
|
||||
//Note: had to add this constructor to work with the code in startup.cs that gets the connection string from the appsettings.json file
|
||||
//and commented out the above on configuring
|
||||
public AyContext(DbContextOptions<AyContext> options) : base(options)
|
||||
|
||||
36
server/models/Subscription.cs
Normal file
36
server/models/Subscription.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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 Subscription : ICoreBizObjectModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public uint Concurrency { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
public bool Active { get; set; }
|
||||
[Required]
|
||||
public ProductGroup PGroup { get; set; }
|
||||
public long? CustomerId { get; set; }
|
||||
[NotMapped]
|
||||
public string CustomerViz { get; set; }
|
||||
|
||||
public string Notes { get; set; }
|
||||
public List<string> Tags { get; set; }
|
||||
|
||||
public List<SubscriptionItem> Items { get; set; } = new List<SubscriptionItem>();
|
||||
|
||||
[NotMapped, JsonIgnore]
|
||||
public SockType SType { get => SockType.Subscription; }
|
||||
|
||||
}//eoc
|
||||
|
||||
}//eons
|
||||
30
server/models/SubscriptionItem.cs
Normal file
30
server/models/SubscriptionItem.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public uint Concurrency { get; set; }
|
||||
|
||||
[Required]
|
||||
public long SubscriptionId { get; set; }
|
||||
[Required]
|
||||
public long ProductId { get; set; }
|
||||
[NotMapped]
|
||||
public string ProductViz { get; set; }
|
||||
[Required]
|
||||
public DateTime ExpireDate { get; set; }
|
||||
[Required]
|
||||
public int Quantity { get; set; } = 1;
|
||||
|
||||
[JsonIgnore]
|
||||
public Subscription Subscription { get; set; }
|
||||
|
||||
}//eoc
|
||||
|
||||
}//eons
|
||||
Reference in New Issue
Block a user