This commit is contained in:
Denis 2023-04-22 01:21:11 +04:00
parent 8b8cafd1b7
commit 503c053836

View File

@ -29,7 +29,6 @@ namespace FlowerShopBusinessLogic.BusinessLogics
public List<ReportBouquetComponentViewModel> GetBouquetComponents() public List<ReportBouquetComponentViewModel> GetBouquetComponents()
{ {
var components = _componentStorage.GetFullList();
var bouquets = _bouquetStorage.GetFullList(); var bouquets = _bouquetStorage.GetFullList();
var list = new List<ReportBouquetComponentViewModel>(); var list = new List<ReportBouquetComponentViewModel>();
foreach (var bouquet in bouquets) foreach (var bouquet in bouquets)
@ -40,13 +39,10 @@ namespace FlowerShopBusinessLogic.BusinessLogics
Components = new List<(string Component, int Count)>(), Components = new List<(string Component, int Count)>(),
TotalCount = 0 TotalCount = 0
}; };
foreach (var component in components) foreach (var component in bouquet.BouquetComponents)
{ {
if (bouquet.BouquetComponents.ContainsKey(component.Id)) record.Components.Add(new(component.Value.Item1.ComponentName, component.Value.Item2));
{ record.TotalCount += component.Value.Item2;
record.Components.Add(new(component.ComponentName, bouquet.BouquetComponents[component.Id].Item2));
record.TotalCount += bouquet.BouquetComponents[component.Id].Item2;
}
} }
list.Add(record); list.Add(record);
} }