Исправления 2

This commit is contained in:
Даниил Путинцев 2024-04-22 11:47:25 +04:00
parent 168dfb3627
commit 8349b6188b

View File

@ -114,15 +114,15 @@ namespace FoodOrdersDatabaseImplement.Implements
.Where(x => x.Dishs.Any(x => x.DishId == model.Id)) .Where(x => x.Dishs.Any(x => x.DishId == model.Id))
.ToList()) .ToList())
{ {
var iceCream = shop.ShopDishs[model.Id]; var dish = shop.ShopDishs[model.Id];
int min = Math.Min(iceCream.Item2, count); int min = Math.Min(dish.Item2, count);
if (min == iceCream.Item2) if (min == dish.Item2)
{ {
shop.ShopDishs.Remove(model.Id); shop.ShopDishs.Remove(model.Id);
} }
else 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 }); shop.UpdateDishs(context, new() { Id = shop.Id, ShopDishs = shop.ShopDishs });
count -= min; count -= min;