diff --git a/ComputerShopDatabaseImplement/Models/Assembly.cs b/ComputerShopDatabaseImplement/Models/Assembly.cs index 1c4fc2e..fa1548b 100644 --- a/ComputerShopDatabaseImplement/Models/Assembly.cs +++ b/ComputerShopDatabaseImplement/Models/Assembly.cs @@ -21,9 +21,12 @@ namespace ComputerShopDatabaseImplement.Models [Required] public string Category { get; private set; } = string.Empty; - [ForeignKey("ComponentId")] + [ForeignKey("AssemblyId")] public virtual List Components { get; set; } = new(); + [ForeignKey("AssemblyId")] + public virtual List Requests { get; set; } = new(); + private Dictionary? _assemblyComponents; [NotMapped] diff --git a/ComputerShopDatabaseImplement/Models/Component.cs b/ComputerShopDatabaseImplement/Models/Component.cs index bb3251a..39514ae 100644 --- a/ComputerShopDatabaseImplement/Models/Component.cs +++ b/ComputerShopDatabaseImplement/Models/Component.cs @@ -19,6 +19,9 @@ namespace ComputerShopDatabaseImplement.Models [Required] public double Cost { get; private set; } + [ForeignKey("ComponentId")] + public virtual List ProductComponents { get; set; } = new(); + [ForeignKey("ComponentId")] public virtual List AssemblyComponents { get; set; } = new(); diff --git a/ComputerShopDatabaseImplement/Models/Product.cs b/ComputerShopDatabaseImplement/Models/Product.cs index 93aef22..63623c1 100644 --- a/ComputerShopDatabaseImplement/Models/Product.cs +++ b/ComputerShopDatabaseImplement/Models/Product.cs @@ -23,7 +23,9 @@ namespace ComputerShopDatabaseImplement.Models public int? ShipmentId { get; set; } - [ForeignKey("ComponentId")] + public virtual Shipment? Shipment { get; set; } + + [ForeignKey("ProductId")] public virtual List Components { get; set; } = new(); private Dictionary? _productComponents;