コード例 #1
0
        public static String DoUpdateCart(int qty, int productId, int userId)
        {
            int productStock = ProductHandler.getProductByID(productId).Stock;

            if (qty == 0)
            {
                CartHandler.deleteCartProduct(productId, userId);
                return("");
            }
            else if (qty < 1)
            {
                return("Quantity must be more than 0");
            }
            else if (qty > productStock)
            {
                return("Quantity can't be more than available stock");
            }
            CartHandler.updateCartProductQty(productId, userId, qty);
            return("");
        }
コード例 #2
0
 public static void DoDeleteCart(int id, int userID)
 {
     CartHandler.deleteCartProduct(id, userID);
 }