Musoev D.T. LabWork_4 Base #4
@ -29,7 +29,6 @@ namespace FlowerShopBusinessLogic.BusinessLogics
|
||||
|
||||
public List<ReportBouquetComponentViewModel> GetBouquetComponents()
|
||||
{
|
||||
var components = _componentStorage.GetFullList();
|
||||
var bouquets = _bouquetStorage.GetFullList();
|
||||
var list = new List<ReportBouquetComponentViewModel>();
|
||||
foreach (var bouquet in bouquets)
|
||||
@ -40,13 +39,10 @@ namespace FlowerShopBusinessLogic.BusinessLogics
|
||||
Components = new List<(string Component, int Count)>(),
|
||||
TotalCount = 0
|
||||
};
|
||||
foreach (var component in components)
|
||||
foreach (var component in bouquet.BouquetComponents)
|
||||
{
|
||||
if (bouquet.BouquetComponents.ContainsKey(component.Id))
|
||||
{
|
||||
record.Components.Add(new(component.ComponentName, bouquet.BouquetComponents[component.Id].Item2));
|
||||
record.TotalCount += bouquet.BouquetComponents[component.Id].Item2;
|
||||
}
|
||||
record.Components.Add(new(component.Value.Item1.ComponentName, component.Value.Item2));
|
||||
record.TotalCount += component.Value.Item2;
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user