Exemplo n.º 1
0
        public ActionResult Add(int id)
        {
            string userId = GetCartId();

            ShoppingCartHelper shopCartHelper = new ShoppingCartHelper();
            int numItems = shopCartHelper.Add(id, userId);

            // Display the confirmation message
            var result = new AddToCartViewModel()
            {
                NumItems = numItems.ToString()
            };

            return Json(result);
        }
Exemplo n.º 2
0
        public ActionResult Remove(int id)
        {
            string userId = GetCartId();

            ShoppingCartHelper shoppingCartHelper = new ShoppingCartHelper();
            shoppingCartHelper.Delete(id, userId);

            return RedirectToAction("Index");
        }