Esempio n. 1
0
        public void AddToCart(Product product, Store store, int quantity)
        {
            ProductStock productStock = CustomerPurchaseItems.FirstOrDefault(x => x.ProductID == product.ProductID &&
                x.StoreID == store.StoreID);

            if (productStock == null)
            {
                CustomerPurchaseItems.Add(new ProductStock
                {
                    ProductID = product.ProductID,
                    Product = product,
                    StoreID = store.StoreID,
                    Store = store,
                    Quantity = quantity,

                });

            }
            else
            {
                productStock.Quantity = quantity;
            }
        }
Esempio n. 2
0
 public void RemoveFromCart(Product product, int index)
 {
     var item = CustomerPurchaseItems.First(x => x.ProductID == index);
     CustomerPurchaseItems.Remove(item);
 }
Esempio n. 3
0
 public void ChangeQuantity(Product product, int index, int quantity)
 {
     var item = CustomerPurchaseItems.First(x => x.ProductID == index);
     item.Quantity = quantity;
 }