Ejemplo n.º 1
0
        public ActionResult AddToCart(int id)
        {
            var product = _productService.GetSingle(id);
            var cart    = _cartSessionService.GetSession();

            _cartService.AddToCart(cart, product);
            _cartSessionService.SetSession(cart);
            TempData.Add("message", string.Format("{0} was successfully added to cart", product.Name));
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 2
0
 public ViewViewComponentResult Invoke()
 {
     return(View(_cartService.GetSession()));
 }