Пример #1
0
        public void removeProduct(int id)
        {
            CartProduct item = findProduct(id);

            if (item.Id != 0)
            {
                this.items.Remove(item);
            }
        }
Пример #2
0
        public void AddToCart(int id, string name, decimal price, int amount, string image)
        {
            CartProduct product = findProduct(id);

            if (product.Id != 0)
            {
                product.Amount += amount;
            }
            else
            {
                this.items.Add(new CartProduct(id, name, price, amount, image));
            }
        }
Пример #3
0
 public void addProduct(CartProduct item)
 {
     this.products.Add(item);
 }
Пример #4
0
        public void reduceAmountOnProduct(int id, int amountToReduce)
        {
            CartProduct item = findProduct(id);

            item.Amount -= amountToReduce;
        }
Пример #5
0
        public void addAmountOnProduct(int id, int amountToAdd)
        {
            CartProduct item = findProduct(id);

            item.Amount += amountToAdd;
        }
Пример #6
0
        public void SetAmountOnProduct(int id, int newAmount)
        {
            CartProduct item = findProduct(id);

            item.Amount = newAmount;
        }