public ActionResult RemoveFromCart(int id) { var cart = ShoppingCart.GetCart(this.HttpContext); string nazwaKsiazki = storeDB.Carty. Single(item => item.RekordId == id).Ksiazka.Tytul; int itemCount = cart.RemoveFromCart(id); var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(nazwaKsiazki) + "Ksizka zostala usunieta z twojego koszyka", CartTotal = cart.GetTotal(), CartCount = cart.GetIlosc(), ItemCount = itemCount, DeleteId = id }; return Json(results); }
public ActionResult RemoveFromCart(int id) { // Remove the item from the cart var cart = ShoppingCart.GetCart(this.HttpContext); // Get the name of the album to display confirmation string bookName = storeDB.Carts .Single(item => item.Id == id).Book.Title; // Remove from cart int itemCount = cart.RemoveFromCart(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(bookName) + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; return Json(results); }