From 4391a40a78a5f193310b25e08bd8cb34dfb439be Mon Sep 17 00:00:00 2001 From: dex_moth Date: Tue, 30 Apr 2024 18:16:30 +0400 Subject: [PATCH] =?UTF-8?q?=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B8=20=D1=83?= =?UTF-8?q?=20=D0=BA=D0=BB=D0=B0=D0=B4=D0=BE=D0=B2=D1=89=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=B8=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BD=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/StoreKeeper.cs | 6 ++++++ .../ComputerHardwareStoreDatabaseImplement/Models/Vendor.cs | 5 +++++ 2 files changed, 11 insertions(+) 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) {