Compare commits
2 Commits
21178474da
...
168dfb3627
Author | SHA1 | Date | |
---|---|---|---|
168dfb3627 | |||
2502c81e43 |
@ -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