Исправления 2
This commit is contained in:
parent
168dfb3627
commit
8349b6188b
@ -114,15 +114,15 @@ namespace FoodOrdersDatabaseImplement.Implements
|
||||
.Where(x => x.Dishs.Any(x => x.DishId == model.Id))
|
||||
.ToList())
|
||||
{
|
||||
var iceCream = shop.ShopDishs[model.Id];
|
||||
int min = Math.Min(iceCream.Item2, count);
|
||||
if (min == iceCream.Item2)
|
||||
var dish = shop.ShopDishs[model.Id];
|
||||
int min = Math.Min(dish.Item2, count);
|
||||
if (min == dish.Item2)
|
||||
{
|
||||
shop.ShopDishs.Remove(model.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
shop.ShopDishs[model.Id] = (iceCream.Item1, iceCream.Item2 - min);
|
||||
shop.ShopDishs[model.Id] = (dish.Item1, dish.Item2 - min);
|
||||
}
|
||||
shop.UpdateDishs(context, new() { Id = shop.Id, ShopDishs = shop.ShopDishs });
|
||||
count -= min;
|
||||
|
Loading…
x
Reference in New Issue
Block a user