Merge branch 'Lab2_hard' into Lab3_hard
This commit is contained in:
commit
168dfb3627
@ -85,20 +85,12 @@ namespace FoodOrdersFileImplement.Implements
|
||||
{
|
||||
var dish = source.Dishs.FirstOrDefault(x => x.Id == model.Id);
|
||||
|
||||
if (dish == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int countStore = source.Shops
|
||||
.SelectMany(x => x.ShopDishs)
|
||||
.Where(y => y.Key == model.Id)
|
||||
.Sum(y => y.Value.Item2);
|
||||
|
||||
|
||||
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)
|
||||
if (dish == null || count > countStore)
|
||||
return false;
|
||||
|
||||
foreach (var shop in source.Shops)
|
||||
|
Loading…
Reference in New Issue
Block a user