ссылки у кладовщика и работника

This commit is contained in:
dex_moth 2024-04-30 18:16:30 +04:00 committed by bekodeg
parent 9688e5eb1c
commit 4733811487
2 changed files with 11 additions and 0 deletions

View File

@ -2,6 +2,7 @@
using ComputerHardwareStoreContracts.ViewModels; using ComputerHardwareStoreContracts.ViewModels;
using ComputerHardwareStoreDataModels.Models; using ComputerHardwareStoreDataModels.Models;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ComputerHardwareStoreDatabaseImplement.Models namespace ComputerHardwareStoreDatabaseImplement.Models
{ {
@ -16,6 +17,11 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
[Required] [Required]
public string Password { get; private set; } = string.Empty; public string Password { get; private set; } = string.Empty;
[ForeignKey("StoreKeeperId")]
public virtual List<Product> Products { get; set; } = new();
[ForeignKey("StoreKeeperId")]
public virtual List<Component> Components { get; set; } = new();
public static StoreKeeper? Create(ComputerHardwareStoreDBContext context, StoreKeeperBindingModel model) public static StoreKeeper? Create(ComputerHardwareStoreDBContext context, StoreKeeperBindingModel model)
{ {

View File

@ -2,6 +2,7 @@
using ComputerHardwareStoreContracts.ViewModels; using ComputerHardwareStoreContracts.ViewModels;
using ComputerHardwareStoreDataModels.Models; using ComputerHardwareStoreDataModels.Models;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ComputerHardwareStoreDatabaseImplement.Models namespace ComputerHardwareStoreDatabaseImplement.Models
{ {
@ -16,6 +17,10 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
[Required] [Required]
public string Password { get; private set; } = string.Empty; public string Password { get; private set; } = string.Empty;
[ForeignKey("VendorId")]
public virtual List<Purchase> Purchases { get; set; } = new();
[ForeignKey("VendorId")]
public virtual List<Build> Builds { get; set; } = new();
public static Vendor? Create(ComputerHardwareStoreDBContext context, VendorBindingModel model) public static Vendor? Create(ComputerHardwareStoreDBContext context, VendorBindingModel model)
{ {