Compare commits

...

2 Commits

View File

@ -85,20 +85,12 @@ namespace FoodOrdersFileImplement.Implements
{ {
var dish = source.Dishs.FirstOrDefault(x => x.Id == model.Id); var dish = source.Dishs.FirstOrDefault(x => x.Id == model.Id);
if (dish == null) int countStore = source.Shops
{ .SelectMany(x => x.ShopDishs)
return false; .Where(y => y.Key == model.Id)
} .Sum(y => y.Value.Item2);
if (dish == null || count > countStore)
var shopDishs = source.Shops.SelectMany(shop => shop.ShopDishs.Where(c => c.Value.Item1.Id == dish.Id));
int countStore = 0;
foreach (var it in shopDishs)
countStore += it.Value.Item2;
if (count > countStore)
return false; return false;
foreach (var shop in source.Shops) foreach (var shop in source.Shops)