public CartItem Find(DBEntities.Dish dish) { for (int i = 0; i < Count; i++) { if (this[i].Dish.Id == dish.Id) { return(this[i]); } } return(null); }
public int GetCount(DBEntities.Dish dish) { for (int i = 0; i < Count; i++) { if (this[i].Dish.Id == dish.Id) { return(this[i].Count); } } return(0); }
public void EditItem(DBEntities.Dish dish, int count) { for (int i = 0; i < Count; i++) { if (this[i].Dish.Id == dish.Id) { this[i].Count = count; this[i].Dish = dish; return; } } Push(dish, 1); }
public AddDish(DBEntities.Dish dish) { InitializeComponent(); if (dish != null) { CurrentDish = dish; LabelDishName.Content = "Добавить к заказу блюдо " + CurrentDish.Name + "?"; LabelDishCost.Content = "Цена: " + CurrentDish.Cost + "руб."; TextBoxDishCount.Text = "1"; } else { Close(); } }
public void Push(DBEntities.Dish dish, int count) { for (int i = 0; i < _items.Length; i++) { if (_items[i].Dish.Id == dish.Id) { _items[i].Count += count; return; } } this[Count] = new CartItem() { Dish = dish, Count = count }; CartChanged?.Invoke(); }
public void Remove(DBEntities.Dish dish) { Remove(dish.Id); }