Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpPost]
- 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 product = _db.Carts
- .Single(item => item.Id == id).Product.Title;
- // Remove from cart
- int itemCount = cart.RemoveFromCart(id);
- // Display the confirmation message
- var results = new ShoppingCartRemoveViewModel
- {
- Message = Server.HtmlEncode(product) +
- " har tagits bort från din kundvagn.",
- CartTotal = cart.GetTotal(),
- CartCount = cart.GetCount(),
- ItemCount = itemCount,
- DeleteId = id
- };
- return Json(results);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement