Esempio n. 1
0
        public ActionResult showCart()
        {
            ShowCartViewModel model = new ShowCartViewModel();

            cart = Session["cart"] as List <OrderProduct>;
            if (cart == null)
            {
                cart = new List <OrderProduct>();
            }
            model.list       = cart;
            model.image      = _imageService.GetAll().ToList();
            model.manufactor = _manufactorService.GetAll().ToList();
            return(PartialView(model));
        }
        public IActionResult Index()
        {
            var cart =
                _cartService
                .GetCart(User);

            if (cart == null)
            {
                return(RedirectToAction("Index", "Home", null));
            }
            var model = new ShowCartViewModel()
            {
                UserId   = cart.UserId,
                Products = cart.Products
            };

            return(View(model));
        }