public RedirectToRouteResult RemoveProductFromCart(CartDto cart, int productId)
        {
            var request = new CartServiceRemoveProductToCartRequest(cart, productId);

            _cartService.RemoveProductFromCart(request);

            return RedirectToAction("ListCartItems");
        }
 public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
 {
     CartDto cart = (CartDto)controllerContext.HttpContext.Session[sessionKey];
     // create the Cart if there wasn't one in the session data
     if (cart == null)
     {
         cart = new CartDto();
         controllerContext.HttpContext.Session[sessionKey] = cart;
     }
     // return the cart
     return cart;
 }
        public object FastDelivery(CartDto cart, bool isFastDelivery, string city)
        {
            city = "aaaaaaaa";

            var request = new CartServiceAddFastDeliveryRequest(cart, isFastDelivery);

            _cartService.AddFastDelivery(request);

            ViewBag.IsCheckOutLinkVisible = false;

            return Json(new { cartHtml = RenderRazorViewToString("Summary", cart), cityText = city }, JsonRequestBehavior.AllowGet);
        }
 public ViewResult Checkout(CartDto cart, ShippingDetailsDto shippingDetails)
 {
     if (cart.Lines.Count() == 0)
     {
         ModelState.AddModelError("", "Sorry, your cart is empty!");
     }
     if (ModelState.IsValid)
     {
         cart.Clear();
         return View("Completed");
     }
     else
     {
         return View(shippingDetails);
     }
 }
 public CartServiceRemoveProductToCartRequest(CartDto cart, int productId)
 {
     Cart = cart;
     ProductId = productId;
 }
 public CartServiceAddFastDeliveryRequest(CartDto cart,bool addFastDelivery)
 {
     AddFastDelivery = addFastDelivery;
     Cart = cart;
 }
 public PartialViewResult Summary(CartDto cart, bool isCheckOutLinkVisible)
 {
     ViewBag.IsCheckOutLinkVisible = isCheckOutLinkVisible;
     return PartialView(cart);
 }
 public ViewResult ListCartItems(CartDto cart)
 {
     return View(cart);
 }
 public RedirectToRouteResult Back(CartDto cart)
 {
     return RedirectToAction("ListCartItems");
 }
 public CartController(CartDto cart, ICartService cartService)
 {
     _cartService = cartService;
 }