Ejemplo n.º 1
0
        public ActionResult BasketSummary()
        {
            ShoppingBasketHelper helper = new ShoppingBasketHelper();

            ViewData["BasketCount"] = helper.GetBasketCount();
            return(PartialView("BasketSummary"));
        }
Ejemplo n.º 2
0
        public ActionResult  RemoveFromCart(int id)
        {
            ShoppingBasketHelper helper = new ShoppingBasketHelper();

//  Get  the  name  of  the  album  to  display  confirmation

            string itemName = db.Items
                              .Single(item => item.ItemId == id).ItemName;

//  Remove  from  cart
            int itemCount = helper.RemoveFromBasket(id);

//  Display  the  confirmation  message
            var results = new  ShoppingBasketRemoveViewModel
            {
                Message     = Server.HtmlEncode(itemName) + "  has  been  removed  from  your  shopping  cart.",
                BasketTotal = helper.GetTotal(),
                BasketCount = helper.GetBasketCount(),
                DeleteId    = id
            };

            return(RedirectToAction("Index"));
        }