Ejemplo n.º 1
0
 public static Boolean AddItem(ShoppingCartItemVM shoppingCartItemVm)
 {
     ProductMapper productMapper = new ProductMapper();
     Product product = productMapper.GetProduct(shoppingCartItemVm.IdProduct);
     if (product.Stock >= shoppingCartItemVm.Quantity)
     {
         ShoppingCartMapper shoppingCartMapper = new ShoppingCartMapper();
         ShoppingCartItem shoppingCartItem = new ShoppingCartItem(shoppingCartItemVm.IdProduct,
             shoppingCartItemVm.Quantity);
         shoppingCartMapper.AddShoppingCartItem(shoppingCartItem);
         return true;
     }
     else
     {
         return false;
     }
 }
Ejemplo n.º 2
0
 public static void AddItem(ShoppingCartItemVM shoppingCartItemVm)
 {
     ShoppingCartMapper shoppingCartMapper = new ShoppingCartMapper();
     ShoppingCartItem shoppingCartItem = new ShoppingCartItem(shoppingCartItemVm.IdProduct, shoppingCartItemVm.Quantity);
     shoppingCartMapper.AddShoppingCartItem(shoppingCartItem);
 }