BACKDEV-408 #8

Merged
bekodeg merged 53 commits from BACKDEV-408 into dev 2024-05-01 12:40:05 +04:00
Showing only changes of commit a30de13f4e - Show all commits

View File

@ -39,12 +39,15 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
Id = model.Id,
Name = model.Name,
Price = model.Price,
Components = model.ProductComponents.Select(x =>
new ProductComponent
{
Component = context.Components.First(y => y.Id == x.Key),
Count = x.Value.Item2
}).ToList()
Components = context.Components
.Where(c => model.ProductComponents.ContainsKey(c.Id))
.Select(c => new ProductComponent()
{
ProductId = model.Id,
ComponentId = c.Id,
Component = c,
Count = model.ProductComponents[c.Id].Item2
}).ToList(),
};
}
public void Update(ProductBindingModel model)