예제 #1
0
 public void RemoveItem(CartItem item)
 {
     _listOfItems.Remove(item);
 }
예제 #2
0
        public bool QuantityIsAvailableInStock(CartItem tryingToAddItem)
        {
            var existingCartItem = ListOfItems.Where(_ => _.Product == tryingToAddItem.Product).FirstOrDefault();

            return((existingCartItem?.Quantity ?? 0 + tryingToAddItem.Quantity) < tryingToAddItem.Product.AvailableQuantity);
        }
예제 #3
0
 public ShoppingCart(Guid userId, CartItem item)
 {
     UserId = userId;
     AddItem(item);
 }
예제 #4
0
 public bool AlreadyContainThisItem(CartItem item)
 {
     return(ListOfItems.Where(_ => _.Product == item.Product).Count() > 0);
 }