public void ReturnProduct(int id, int count) { FoodStuff food = Basket[id]; for (int i = 0; i < count; i++) { Basket.Remove(food); } }
public static List <FoodStuff> AddToBusket(FoodStuff food, int count) { for (int i = 0; i < count; i++) { Basket.Add(food); } if (Basket.Count > Bag.Capacity) { throw new BagException("Products will not fit in the bag"); } return(Basket); }
public double CalculateSumm(int id, int count) { FoodStuff food = ProductInCell; if (CountFoodInCell < count) { throw new ShopException($"Cell have {CountFoodInCell} products, not more"); } CountFoodInCell -= count; if (CountFoodInCell == 0) { Window.DeleteFoodFromCell(id); } Buyer.AddToBusket(food, count); return(food.CalculateSumm(food, count)); }
public double CalculateSumm(FoodStuff food, int count) { return(food.Price * count); }
public Cell(FoodStuff food, int count) { ProductInCell = food; CountFoodInCell = count; }
public Cell() { ProductInCell = new FoodStuff(); CountFoodInCell = NameGenerator.RandomInt(1, 10); }