// GET: Cart public ActionResult Index() { var cartItems = cartMenager.DownloadCart(); var totalPrice = cartMenager.DownloadCartValue(); CartViewModel cartVM = new CartViewModel() { CartItem = cartItems, TotalPrice = totalPrice }; return(View(cartVM)); }
public ActionResult RemoveFromCart(int bookId) { int numberOfItems = cartMenager.RemoveFromCart(bookId); int numberOfCartItems = cartMenager.DownloadQuantityOfCartItems(); decimal cartValue = cartMenager.DownloadCartValue(); var result = new CartRemovalViewModel { IdItemsToRemove = bookId, NumberItemsToRemove = numberOfItems, CartTotalPrice = cartValue, CartQuantityItem = numberOfCartItems }; return(Json(result)); }