diff --git a/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Models/StoreKeeper.cs b/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Models/StoreKeeper.cs index 1c2028d..2143e5b 100644 --- a/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Models/StoreKeeper.cs +++ b/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Models/StoreKeeper.cs @@ -2,6 +2,7 @@ using ComputerHardwareStoreContracts.ViewModels; using ComputerHardwareStoreDataModels.Models; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace ComputerHardwareStoreDatabaseImplement.Models { @@ -16,6 +17,11 @@ namespace ComputerHardwareStoreDatabaseImplement.Models [Required] public string Password { get; private set; } = string.Empty; + [ForeignKey("StoreKeeperId")] + public virtual List Products { get; set; } = new(); + [ForeignKey("StoreKeeperId")] + public virtual List Components { get; set; } = new(); + public static StoreKeeper? Create(ComputerHardwareStoreDBContext context, StoreKeeperBindingModel model) { diff --git a/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Models/Vendor.cs b/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Models/Vendor.cs index bc9567d..4465a20 100644 --- a/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Models/Vendor.cs +++ b/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Models/Vendor.cs @@ -2,6 +2,7 @@ using ComputerHardwareStoreContracts.ViewModels; using ComputerHardwareStoreDataModels.Models; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace ComputerHardwareStoreDatabaseImplement.Models { @@ -16,6 +17,10 @@ namespace ComputerHardwareStoreDatabaseImplement.Models [Required] public string Password { get; private set; } = string.Empty; + [ForeignKey("VendorId")] + public virtual List Purchases { get; set; } = new(); + [ForeignKey("VendorId")] + public virtual List Builds { get; set; } = new(); public static Vendor? Create(ComputerHardwareStoreDBContext context, VendorBindingModel model) {