コード例 #1
0
        public RedirectToRouteResult RemoveFromCart(Entities.ComplexTypes.Cart cart, int productId)
        {
            Product product = _productService.Get(productId);

            cart.RemoveFromCart(product);
            return(RedirectToAction("Index", cart));
        }
コード例 #2
0
        public ActionResult Checkout(Entities.ComplexTypes.Cart cart)
        {
            CartViewModel cartViewModel = new CartViewModel
            {
                ShippingDetail = new ShippingDetail(),
                Cart           = cart
            };

            return(View(cartViewModel));
        }
コード例 #3
0
        public ActionResult Checkout(CartViewModel cartViewModel, Entities.ComplexTypes.Cart cart)
        {
            var    cartList         = cart;
            string cartListToJSON   = Newtonsoft.Json.JsonConvert.SerializeObject(cartList);
            string userName         = User.Identity.Name;
            int    userId           = GetUserIdByUserName(userName);
            int    shippingDetailId = GetShippingDetailId(cartViewModel);
            int    cartId           = GetCartId(cartListToJSON);
            int    OrderDetailId    = GetOrderDetailId(userId, shippingDetailId, cartId);

            cart.Clear();
            CompletedViewModel completedViewModel = new CompletedViewModel
            {
                UserName      = User.Identity.Name,
                OrderdetailId = OrderDetailId
            };

            return(RedirectToAction("Completed", "Cart", completedViewModel));
        }
コード例 #4
0
 public ViewResult Index(Entities.ComplexTypes.Cart cart)
 {
     return(View(cart));
 }
コード例 #5
0
 public PartialViewResult CartSummary(Entities.ComplexTypes.Cart cart)
 {
     return(PartialView(cart));
 }