Merge branch 'hard_lab2' into hard_lab3

This commit is contained in:
DavidMakarov 2024-05-03 15:40:59 +04:00
commit cc2bb7f7f5

View File

@ -87,7 +87,6 @@ namespace FlowerShopFileImplement.Implements
public bool MakeSale(IFlowerModel model, int count) public bool MakeSale(IFlowerModel model, int count)
{ {
// TODO: разобраться
var flower = source.Flowers.FirstOrDefault(x => x.Id == model.Id); var flower = source.Flowers.FirstOrDefault(x => x.Id == model.Id);
int countInShops = source.Shops.SelectMany(x => x.ShopFlowers).Sum(y => y.Key == model.Id ? y.Value.Item2 : 0); int countInShops = source.Shops.SelectMany(x => x.ShopFlowers).Sum(y => y.Key == model.Id ? y.Value.Item2 : 0);
@ -95,7 +94,6 @@ namespace FlowerShopFileImplement.Implements
{ {
return false; return false;
} }
foreach (var shop in source.Shops) foreach (var shop in source.Shops)
{ {
var shopFlowers = shop.ShopFlowers.Where(x => x.Key == model.Id); var shopFlowers = shop.ShopFlowers.Where(x => x.Key == model.Id);