Assembly orders 2

This commit is contained in:
the 2023-05-18 18:33:33 +04:00
parent 1a849e4fbd
commit 49b8f15517
3 changed files with 18 additions and 1 deletions

View File

@ -18,5 +18,10 @@ namespace ComputerShopContracts.BindingModels
get;
set;
} = new();
public Dictionary<int, (IOrderModel, int)> AssemblyOrders
{
get;
set;
} = new();
}
}

View File

@ -21,6 +21,11 @@ namespace ComputerShopContracts.ViewModels
get;
set;
} = new();
public Dictionary<int, (IOrderModel, int)> AssemblyOrders
{
get;
set;
} = new();
public int ClientId { get; set; }
[DisplayName("ФИО клиента")]

View File

@ -39,7 +39,7 @@ namespace ComputerShopDatabaseImplement.Models
private Dictionary<int, (IOrderModel, int)>? _assemblyOrders = null;
[NotMapped]
public Dictionary<int, (IOrderModel, int)> AssemblyPrders
public Dictionary<int, (IOrderModel, int)> AssemblyOrders
{
get
{
@ -70,6 +70,12 @@ namespace ComputerShopDatabaseImplement.Models
{
Component = context.Components.First(y => y.Id == x.Key),
Count = x.Value.Item2
}).ToList(),
Orders = model.AssemblyOrders.Select(x => new
AssemblyOrder
{
Order = context.Orders.First(y => y.Id == x.Key),
Count = x.Value.Item2
}).ToList()
};
}
@ -84,6 +90,7 @@ namespace ComputerShopDatabaseImplement.Models
AssemblyName = AssemblyName,
Price = Price,
AssemblyComponents = AssemblyComponents,
AssemblyOrders = AssemblyOrders,
ClientId = ClientId
};
public void UpdateComponents(ComputerShopDatabase context, AssemblyBindingModel model)