public ActionResult RemoveFromBasket(int productID) { int quantityPositions = basketManager.RemoveFromBasket(productID); int quantityBasketPositions = basketManager.DownloadQuantityBasketPositions(); decimal basketValue = basketManager.DownloadBasketValue(); var result = new BasketRemoveViewModel { IdPositionRemoved = productID, QuantityPositionsRemoved = quantityPositions, BasketTotalPrice = basketValue, BasketQuantityPositions = quantityBasketPositions }; return(Json(result)); }
public ActionResult RemoveFromBasket(int itemid) { CartManager CartManager = new CartManager(this.sessionManager, this.db); int itemCount = CartManager.RemoveFromCart(itemid); int cartItemsCount = CartManager.GetCartItemsCount(); decimal cartTotal = CartManager.GetCartTotalPrice(); // Return JSON to process it in JavaScript var result = new BasketRemoveViewModel { RemoveItemId = itemid, RemovedItemCount = itemCount, CartTotal = cartTotal, CartItemsCount = cartItemsCount }; return(Json(result)); }