Exemplo n.º 1
0
        public ActionResult AddToCart(int productId)
        {
            var productToBeAdded = _productService.GetById(productId);
            var cart             = _cardSessionService.GetCart();

            _cartService.AddToCart(cart, productToBeAdded);
            _cardSessionService.SetCard(cart);
            TempData.Add("message", string.Format("{0} Ürün başarıyla eklendi.", productToBeAdded.ProductName));
            return(RedirectToAction("Index", "Product"));
        }
Exemplo n.º 2
0
        public ViewViewComponentResult Invoke()
        {
            var model = new CartSummaryViewModel()
            {
                Cart = _cartSessionService.GetCart()
            };

            return(View(model));
        }