This commit is contained in:
bekodeg 2024-05-01 18:13:45 +04:00
parent 79fcf7e9a9
commit 0ac9228a41
5 changed files with 12 additions and 3 deletions

View File

@ -35,6 +35,10 @@ Global
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Release|Any CPU.Build.0 = Release|Any CPU
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -8,5 +8,6 @@ namespace ComputerHardwareStoreContracts.BindingModels
public string Name { get; set; } = string.Empty;
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new();
public IStoreKeeperModel StoreKeeper { get; set; }
}
}

View File

@ -11,5 +11,6 @@ namespace ComputerHardwareStoreContracts.ViewModels
[DisplayName("Цена")]
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new();
public IStoreKeeperModel StoreKeeper { get; set; }
}
}

View File

@ -4,7 +4,7 @@
{
string Name { get; }
double Price { get; }
int StoreKeeperId { get; }
public IStoreKeeperModel StoreKeeper { get; }
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; }
}
}

View File

@ -14,7 +14,9 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
public string Name { get; set; } = string.Empty;
[Required]
public double Price { get; set; }
public int StoreKeeperId { get; private set; }
[NotMapped]
IStoreKeeperModel IProductModel.StoreKeeper => StoreKeeper;
public virtual StoreKeeper StoreKeeper {get; set;} = new();
private Dictionary<int, (IComponentModel, int)>? _productComponents = null;
[NotMapped]
public Dictionary<int, (IComponentModel, int)> ProductComponents
@ -62,7 +64,8 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
Id = Id,
Name = Name,
Price = Price,
ProductComponents = ProductComponents
ProductComponents = ProductComponents,
StoreKeeper = StoreKeeper,
};
public static void UpdateComponents(ComputerHardwareStoreDBContext context, ProductBindingModel model)