Пример #1
0
        public void ReturnProduct(int id, int count)
        {
            FoodStuff food = Basket[id];

            for (int i = 0; i < count; i++)
            {
                Basket.Remove(food);
            }
        }
Пример #2
0
 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);
 }
Пример #3
0
        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));
        }
Пример #4
0
 public double CalculateSumm(FoodStuff food, int count)
 {
     return(food.Price * count);
 }
Пример #5
0
 public Cell(FoodStuff food, int count)
 {
     ProductInCell   = food;
     CountFoodInCell = count;
 }
Пример #6
0
 public Cell()
 {
     ProductInCell   = new FoodStuff();
     CountFoodInCell = NameGenerator.RandomInt(1, 10);
 }