/// <summary> /// Adds an item to the cart /// Level: Logic /// </summary> /// <param name="UserID">The User ID</param> /// <param name="ProductID">The Product ID</param> /// <param name="Quantity">The Quantity</param> public void AddToCart(Guid UserID, Guid ProductID, int Quantity) { try { ShoppingCartRepository myRepository = new ShoppingCartRepository(false); if (myRepository.ItemExists(ProductID, UserID)) { myRepository.ChangeQuantity(ProductID, UserID, Quantity); } else { ShoppingCart myShoppingCartItem = new ShoppingCart(); myShoppingCartItem.UserFK = UserID; myShoppingCartItem.ProductFK = ProductID; myShoppingCartItem.Quantity = Quantity; myRepository.AddToCart(myShoppingCartItem); } } catch (Exception Exception) { throw Exception; } }