示例#1
0
        public CartDTO Post([FromBody] CartItemDTO value)
        {
            var cart     = checkoutManager.GetCart();
            var cartItem = cart.CartItems.Where(i => i.SKU == value.SKU).SingleOrDefault();

            if (cartItem != null)
            {
                cartItem.Quantity = value.Quantity;
                var recalculatedCart = checkoutManager.GetCart(cart.CartItems);

                checkoutManager.SaveCart(cartItem);
                return(recalculatedCart);
            }
            else
            {
                return(cart);
            }
        }
 public ActionResult Cart()
 {
     return(View(_checkoutManager.GetCart()));
 }