Example #1
0
 public void Add(InventoryProduct product, int quantity)
 {
     for (var i = 0; i < quantity; i++)
     {
         Add(product);
     }
 }
Example #2
0
        public void Add(InventoryProduct product)
        {
            var thisProductInCart = Items.SingleOrDefault(p => p.Product.Id == product.Id);

            if (thisProductInCart == null)
            {
                var purchaseItem = new PurchaseItem()
                {
                    Product = product,
                    Quantity = 1
                };

                Items.Add(purchaseItem);
            }
            else
            {
                thisProductInCart.Quantity++;
            }
        }