internal void ChangeDish(string name, int amount) { var dish = OrderedDishes.Find(x => x.Dish.Name == name); if (dish == null) { OrderedDishes.Add(new OrderedDish(name, amount)); } else { dish.Amount = amount; } WaiterManager.AddOrder(Number); }
private void CheckBonus() { var bonuses = _unitOfWork.BonusActions.GetAll().Where(b => b.ExcessSum < TotalSum); var bonus = bonuses.OrderBy(b => b.ExcessSum).LastOrDefault(); if (bonus != null) { BonusHeaderString = $"{bonus.Dish.Name} | ЗАКАЗ > {bonus.ExcessSum}"; BonusInfo = bonus.Description; // добавить бонусное блюдо _bonusDish = new OrderedDish { DishId = bonus.DishId, OrderedPrice = 0, Quantity = 1 }; OrderedDishes.Add(_bonusDish); } else { BonusInfo = "Извините, но за Ваш заказ бонус не предусмотрен."; } }