public void RemoveItem(CartItem item) { _listOfItems.Remove(item); }
public bool QuantityIsAvailableInStock(CartItem tryingToAddItem) { var existingCartItem = ListOfItems.Where(_ => _.Product == tryingToAddItem.Product).FirstOrDefault(); return((existingCartItem?.Quantity ?? 0 + tryingToAddItem.Quantity) < tryingToAddItem.Product.AvailableQuantity); }
public ShoppingCart(Guid userId, CartItem item) { UserId = userId; AddItem(item); }
public bool AlreadyContainThisItem(CartItem item) { return(ListOfItems.Where(_ => _.Product == item.Product).Count() > 0); }