Advertisement
Guest User

Untitled

a guest
May 27th, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. [HttpPost]
  2. public ActionResult RemoveFromCart(int id)
  3. {
  4. // Remove the item from the cart
  5. var cart = ShoppingCart.GetCart(this.HttpContext);
  6.  
  7. // Get the name of the album to display confirmation
  8. string product = _db.Carts
  9. .Single(item => item.Id == id).Product.Title;
  10.  
  11. // Remove from cart
  12. int itemCount = cart.RemoveFromCart(id);
  13.  
  14. // Display the confirmation message
  15. var results = new ShoppingCartRemoveViewModel
  16. {
  17. Message = Server.HtmlEncode(product) +
  18. " har tagits bort från din kundvagn.",
  19. CartTotal = cart.GetTotal(),
  20. CartCount = cart.GetCount(),
  21. ItemCount = itemCount,
  22. DeleteId = id
  23. };
  24. return Json(results);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement