public ActionResult RemoveFromCart(int id) { var cart = ShoppingCart.GetCard(this.HttpContext); var book = db.Books.FirstOrDefault(b => b.Id == id); if (book == null) { return(Json(HttpNotFound())); } var bookName = book.Title; var itemCount = cart.RemoveFromCard(id); book.Quantity += 1; db.Entry(book).State = EntityState.Modified; db.SaveChanges(); 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)); }
public ActionResult RemoveFromCart(int id) { Cart cart = _db.Carts.SingleOrDefault(c => c.Id == id); if (cart != null) { ShoppingCart shoppingCart = ShoppingCart.GetCart(HttpContext); Guitar guitar = cart.Guitar; string guitarName = string.Format("{0} {1} {2}", guitar.Brand.Name, guitar.Series, guitar.Model); int itemCount = shoppingCart.RemoveFromCart(id); ShoppingCartRemoveViewModel viewModel = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(guitarName) + " удалена из БД.", Total = shoppingCart.GetTotal(), CartCount = shoppingCart.GetCount(), ItemCount = itemCount, DeleteId = id }; return Json(viewModel); } else { return HttpNotFound(); } }
public ActionResult AddToCart(int id) { // Add it to the shopping cart var cart = ShoppingCart.GetCart(this.HttpContext); int count = cart.AddToCart(id); // Retrieve the item from the database var addedItem = unitOfWork.SiteTemplateRepository.dbSet .Single(item => item.Id == id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(addedItem.Name) + " has been added to your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = count, DeleteId = id }; return(Json(results)); // Go back to the main store page for more shopping // return RedirectToAction("Index"); }
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 albumName = storeDB.Carts .Single(item => item.RecordId == id).Album.Title; // Remove from cart int itemCount = cart.RemoveFromCart(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(albumName) + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; Session["NumeroItems"] = (results == null?0:results.CartCount); 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 productName = storeDB.Carts .Single(item => item.RecordID == id).Product.ProductDescription; // Remove from cart int itemCount = cart.RemoveFromCart(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(productName) + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; return(Json(results)); }
public ActionResult RemoveFromCart(int id) { // Retrieve the current user's shopping cart var cart = ShoppingCart.GetCart(storeDB, this.HttpContext); // Get the name of the album to display confirmation string productname = storeDB.Carts .Single(item => item.RecordId == id).Product.ProductName; // Remove from cart int itemCount = cart.RemoveFromCart(id); storeDB.SaveChanges(); string removed = (itemCount > 0) ? " 1 copy of " : string.Empty; // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = removed + productname + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), DeleteId = id }; return(Json(results)); }
public ActionResult RemoveFromCart(int id) { // Remove the item from the cart var cart = ShoppingCartRepository.GetCart(this.HttpContext); string cartIds = cart.GetCartId(); string productName = repositoryCart.GetFirstOrDefault(id).tblProduct.ProductName; // Get the name of the product to display confirmation //string productName = uow.GetRepositoryInstance<tblCart>().GetProduct().DistinctBy(id).tblProduct.ProductName; // Remove from cart int itemCount = cart.RemoveFromCart(cartIds, id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(productName) + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; return(Json(results)); }
public ActionResult AddToCart(int id, string color) { // Retrieve the item from the database var addedItem = _storeDb.Items .Single(item => item.ID == id); // Add it to the shopping cart var cart = ShoppingCart.GetCart(this.HttpContext); if (string.IsNullOrWhiteSpace(color)) { color = "UnSelected"; } int count = cart.AddToCart(addedItem, color); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(addedItem.Name) + " has been added to your shopping cart.", CartTotal = cart.GetTotal(), SubTotal = cart.GetSubTotal(), CartCount = cart.GetCount(), ItemCount = count, DeleteId = id }; return(Json(results)); // Go back to the main store page for more shopping // return RedirectToAction("Index"); }
//public EmptyResult AddToCart(int id) //{ // // Retrieve the album from the database // var addedAlbum = StoreDB.Phones // .Single(phone => phone.Id == id); // // Add it to the shopping cart // var cart = ShoppingCart.GetCart(this.HttpContext); // cart.AddToCart(addedAlbum); // // Go back to the main store page for more shopping // //return RedirectToAction("Index", new { returnUrl }); // return new EmptyResult(); //} public ActionResult AddToCart(int id) { // Retrieve the album from the database var addedAlbum = StoreDB.I_commodities .Single(phone => phone.Code == id); // Add it to the shopping cart var cart = ShoppingCart.GetCart(this.HttpContext); string cartId = cart.GetCartId(this.HttpContext); int itemCount = cart.AddToCart(addedAlbum); int RecordId = StoreDB.Carts .Single(item => item.I_commodityCode == id && item.CartId == cartId).RecordId; var results = new ShoppingCartRemoveViewModel { CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = RecordId }; return(Json(results)); }
public ActionResult RemoveFromCart(int id) { // Remove the item from the cart ShoppingCart cart = new ShoppingCart(_context); cart = cart.GetCart(HttpContext); // Get the name of the album to display confirmation Cart c = _context.Carts.Find(id); Album al = _context.Albums.Find(c.AlbumId); string albumName = al.Title; // Remove from cart int itemCount = cart.RemoveFromCart(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = HtmlEncoder.Default.Encode(albumName) + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), 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 var album = storeDB.Carts .Single(item => item.RecordId == id).Album; // Remove from cart int itemCount = cart.RemoveFromCart(id); // log telemetry data to understand when people remove items from the basket LogTelemetryEvent(cart, album); //if (cart.GetTotal() > 30) // throw new InvalidOperationException("Value is > 30, not allowed to remove items....:-)"); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(album.Title) + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; return(Json(results)); }
public async Task <IActionResult> RemoveFromCart([FromRoute] Guid?id, [FromServices] MusicStoreDbContext dbContext, CancellationToken cancellationToken = default) { if (!id.HasValue || id.Value == Guid.Empty) { return(BadRequest()); } // Get the name of the album to display confirmation Cart cartRecord = await dbContext.Carts .Include(x => x.Album) .SingleAsync(item => item.RecordId == id.Value); string albumName = cartRecord.Album.Title; // Remove from cart int itemCount = await _shoppingCart.RemoveFromCart(id.Value, cancellationToken); cancellationToken.ThrowIfCancellationRequested(); // Display the confirmation message var results = new ShoppingCartRemoveViewModel() { Message = albumName + "has been removed from your shopping cart.", CartTotal = await _shoppingCart.GetTotal(), CartCount = await _shoppingCart.GetCount(), ItemCount = itemCount, DeleteId = id.Value }; return(Json(results)); }
public async Task <ActionResult> RemoveFromCart(int id) { var cartId = new ShoppingCartHelper(this.HttpContext).GetCartId(); var cart = new Cart() { RecordId = id, CartId = cartId }; int itemCount = await apiHelper.PostAsync <Cart, int>("/api/ShoppingCart/RemoveFromCart", cart); string albumName = await apiHelper.GetAsync <string>("/api/Store/AlbumName?id=" + id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = HtmlEncoder.Default.Encode(albumName) + " has been removed from your shopping cart.", CartTotal = await apiHelper.GetAsync <decimal>("/api/ShoppingCart/Total?id=" + cartId), CartCount = await apiHelper.GetAsync <int>("/api/ShoppingCart/Count?id=" + cartId), ItemCount = itemCount, DeleteId = id }; return(Json(results)); //return RedirectToAction("Index"); }
public IActionResult RemoveFromCart([FromBody] CartDeleteViewModel c) { Console.WriteLine("ShoppingCart RemoveFromCart, Id: " + c.ShoppingCartId); // Remove the item from the cart var cart = ShoppingCartRepository.GetCart(storeDB); // Get the name of the album to display confirmation var record = storeDB.Carts .Single(item => item.RecordId == c.RecordId); Console.WriteLine("AlbumId: " + record.AlbumId); var albumName = new AlbumRepository(storeDB).Get(record.AlbumId).Title; Console.WriteLine("Album title: " + albumName); // Remove from cart int itemCount = cart.RemoveFromCart(c); Console.WriteLine("ShoppingCart Controller, itemCount: " + itemCount); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = albumName + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(c.ShoppingCartId), CartCount = cart.GetCount(c.ShoppingCartId), ItemCount = itemCount, DeleteId = c.RecordId }; return(Json(results)); }
public JsonResult 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 ItemName = db.PurchaseOrders .Single(item => item.PurchaseOrdersID == id).ProductCatalog.SkewNumber.ToString(); // Remove from cart int itemCount = cart.RemoveFromCart(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(ItemName) + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; return(Json(results, JsonRequestBehavior.AllowGet)); }
private ShoppingCartRemoveViewModel GetRemoveResult(int rid, string albumName) { int itemCount = 0; // Remove the item from the cart var cart = ShoppingCart.GetCart(this.Context); string cmd = "public.get_album_title_by_recordid"; var res = DBHelper.ExecuteScalar(cmd, new { rid = rid }, null, null, CommandType.StoredProcedure); if (res != null) { albumName = res.ToString(); itemCount = cart.RemoveFromCart(rid); } var results = new ShoppingCartRemoveViewModel { Message = albumName + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = rid }; return(results); }
public ActionResult RemoveFromCart(int id) { // Remove the item from the cart var user = NHibernateSession.Get <AnonymousUser>(TypedSession.UserId); var cartItem = user.Items.Single(p => p.Id == id); // Remove from cart if (cartItem.Count == 1) { user.Items.Remove(cartItem); } else { cartItem.Count--; } // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(cartItem.Album.Title) + " has been removed from your shopping cart.", CartTotal = user.Items.Select(p => new { price = p.Count * p.Album.Price }).Sum(p => p.price), CartCount = user.Items.Sum(p => p.Count), ItemCount = 10, DeleteId = id }; return(Json(results)); }
public ActionResult RemoveFromCart(int id) { string myShoppingCartId = ShoppingCart.MyShoppingCartId(this.HttpContext); // Remove the item from the cart var cart = ShoppingCart.GetCart(this.HttpContext); // Get the name of the album to display confirmation string produitName = db.GetCartByid(id).Produit.Title; // Remove from cart int?itemCount = db.ShoppingRemoveFromCart(id, myShoppingCartId); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(produitName) + " has been removed from your shopping cart.", CartTotal = db.ShoppingGetTotal(myShoppingCartId), CartCount = db.ShoppingGetCount(myShoppingCartId), ItemCount = itemCount, DeleteId = id }; return(Json(results)); }
public async Task <ActionResult> RemoveFromCart(int id) { _logger.Info("ShoppingCartController RemoveFromCart method"); var cart = ShoppingCart.GetCart(_storeContext, this); var albumName = await _storeContext.Carts .Where(i => i.RecordId == id) .Select(i => i.Album.Title) .SingleOrDefaultAsync(); var itemCount = await cart.RemoveFromCart(id); await _storeContext.SaveChangesAsync(); var removed = (itemCount > 0) ? " 1 copy of " : string.Empty; var results = new ShoppingCartRemoveViewModel { Message = removed + albumName + " has been removed from your shopping cart.", CartTotal = await cart.GetTotal(), CartCount = await cart.GetCount(), ItemCount = itemCount, DeleteId = id }; return(Json(results)); }
public async Task <ActionResult> RemoveFromCart(int id) { #if DEBUG _logger?.Debug($"RemoveFromCart action of controller {this.GetType().Name} invoked"); #endif var cart = ShoppingCart.GetCart(_storeContext, this); var albumName = await _storeContext.Carts .Where(i => i.RecordId == id) .Select(i => i.Album.Title) .SingleOrDefaultAsync(); var itemCount = await cart.RemoveFromCart(id); await _storeContext.SaveChangesAsync(); _logger.Info($"Album with id {id} removed from cart.Cart count {await cart.GetCount()}"); var removed = (itemCount > 0) ? " 1 copy of " : string.Empty; var results = new ShoppingCartRemoveViewModel { Message = removed + albumName + " has been removed from your shopping cart.", CartTotal = await cart.GetTotal(), CartCount = await cart.GetCount(), 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 item to display confirmation var itemId = storeDB.Cart.Single(c => c.RecordId == id).ItemId; string itemName = storeDB.Item .Single(item => item.Id == itemId).Name; // Remove from cart int itemCount = cart.RemoveFromCart(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(itemName) + " has been removed from your shopping cart.", CartTotal = "€" + cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; return(Json(results)); }
public ActionResult RemoveFromCart(int id) { // Remove the item from the cart _shoppingCartService.ShoppingCartId = _contextService.GetCartId(this.HttpContext); // Get the name of the album to display confirmation string movieName = storeDB.Carts .Single(item => item.RecordId == id).Movie.Title; // Remove from cart int itemCount = _shoppingCartService.RemoveFromCart(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(movieName) + " has been removed from your shopping cart.", CartTotal = _shoppingCartService.GetTotal(), CartCount = _shoppingCartService.GetCount(), ItemCount = itemCount, DeleteId = id }; return(Json(results)); }
public async Task <ActionResult> RemoveFromCart(int id) { var cart = ShoppingCart.GetCart(_storeContext, this); var albumName = await _storeContext.Carts .Where(i => i.RecordId == id) .Select(i => i.Album.Title) .SingleOrDefaultAsync(); var itemCount = await cart.RemoveFromCart(id); await _storeContext.SaveChangesAsync(); var removed = (itemCount > 0) ? " 1 copy of " : string.Empty; var results = new ShoppingCartRemoveViewModel { Message = removed + albumName + " has been removed from your shopping cart.", CartTotal = await cart.GetTotal(), CartCount = await cart.GetCount(), ItemCount = itemCount, DeleteId = id }; if (counter.GetInstance(Counters.ItemsInCard).RawValue > 0) { counter.Decrement(Counters.ItemsInCard); } return(Json(results)); }
public ActionResult AddToCartManually(int id) { // Remove the item from the cart var cart = ShoppingCart.GetCart(this.HttpContext); // Get the name of the album to display confirmation string albumName = storeDB.Carts .Single(item => item.RecordId == id).Item.name; // Remove from cart int itemCount = cart.AddToCartManually(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(albumName) + "Item is added to your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; return(Json(results)); }
//[HttpPost] public ActionResult RemoveFromCart(int id) { var cart = ShoppingCart.GetCart(this.HttpContext); string itemName = storeDB.Carts .Single(item => item.RecordId == id).Item.Title; int itemCount = cart.RemoveFromCart(id); var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(itemName) + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; // return RedirectToAction("ShoppingCart"); // return Json(results); //return View("ShoppingCart"); //return RedirectToAction("Complete"); // return View(); return(RedirectToAction("Index")); }
public ActionResult UpdateCartCount(int id, int cartCount) { // Get the cart var cart = ShoppingCart.GetCart(storeDB, this.HttpContext); // Get the name of the album to display confirmation string albumName = storeDB.Carts .Single(item => item.RecordId == id).Product.ProductName; int price = Convert.ToInt32(storeDB.Carts.Single(item => item.RecordId == id).Product.Price); // Update the cart count int itemCount = cart.UpdateCartCount(id, cartCount); //Prepare messages string msg = "The quantity of " + Server.HtmlEncode(albumName) + " has been refreshed in your shopping cart."; if (itemCount == 0) { msg = Server.HtmlEncode(albumName) + " has been removed from your shopping cart."; } // // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = msg, CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = cartCount * price, 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 product to display confirmation string productName = storeDB.Carts .Single(item => item.ShopId == id).Prduct.Name; // Remove from cart int itemCount = cart.RemoveFromCart(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(productName) + " sepetinizden silindi.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; return(Json(results)); }
public ActionResult RemoveFromCart(int id) { // Remove the item from the cart var cart = ShoppingCart.GetCart(this.HttpContext); //傳送HttpContext透過context.Session[CartSessionKey]取得某cartId的cart // Get the name of the album to display confirmation string albumName = storeDB.Carts .Single(item => item.RecordId == id).Album.Title; // Remove from cart int itemCount = cart.RemoveFromCart(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(albumName) + "已從購物車中移除", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), 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 product, to display confirmation try { string productName = context.Carts.SingleOrDefault(item => item.ID == id).Product.Name; var quantity = context.Carts.SingleOrDefault(item => item.ID == id).Quantity; string productQuantity = (quantity - 1).ToString(); string manufacturer = context.Carts.SingleOrDefault(item => item.ID == id).Product.Manufacturer.Name; // Remove from cart int itemCount = cart.RemoveFromCart(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = "The product has been removed. " + "\'" + Server.HtmlEncode(productQuantity) + "\'" + " " + Server.HtmlEncode(manufacturer) + " " + Server.HtmlEncode(productName) + " left in the cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; return(Json(results)); } catch { return(new HttpStatusCodeResult((int)HttpStatusCode.InternalServerError)); } }
// // GET: /Store/AddToCart/5 public ActionResult AddToCart(int id) { // Retrieve the album from the database var addedAlbum = storeDB.Albums .Single(album => album.AlbumId == id); addedAlbum.Genre.Name.ToString(); // Add it to the shopping cart var cart = ShoppingCart.GetCart(this.HttpContext); cart.AddToCart(addedAlbum); Session["NumeroItems"] = (cart == null?0:cart.GetCount()); // Go back to the main store page for more shopping String genre = addedAlbum.Genre.Name.ToString(); var genreModel = storeDB.Genres.Include("Albums").Single(g => g.Name == genre); var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(addedAlbum.Title) + " has been Add to your shopping cart." }; return(Json(results)); }
public async Task <IActionResult> RemoveFromCart( int id, CancellationToken requestAborted) { // Retrieve the current user's shopping cart var cart = ShoppingCart.GetCart(DbContext, HttpContext); // Get the name of the album to display confirmation var cartItem = await DbContext.CartItems .Where(item => item.CartItemId == id) .Include(c => c.Album) .SingleOrDefaultAsync(); // Remove from cart int itemCount = cart.RemoveFromCart(id); await DbContext.SaveChangesAsync(requestAborted); string removed = (itemCount > 0) ? " 1 copy of " : string.Empty; // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = removed + cartItem.Album.Title + " has been removed from your shopping cart.", CartTotal = await cart.GetTotal(), CartCount = await cart.GetCount(), 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 albumName = storeDB.Carts .Single(item => item.RecordId == id).Album.Title; // Remove from cart. Note that for simplicity, we're // removing all rather than decrementing the count. cart.RemoveFromCart(id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(albumName) + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), DeleteId = id }; return Json(results); }
public ActionResult RemoveFromCart(string id) { var cart = ShoppingCart.GetCart(HttpContext); var loadedCart = _cartReader.Load(id); if(loadedCart.ValueMissing) { return RedirectToAction("Index"); } var albumName = loadedCart.Value.Album.Title; var itemCount = cart.RemoveFromCart(id); var results = new ShoppingCartRemoveViewModel { Message = Server.HtmlEncode(albumName) + " has been removed from your shopping cart.", CartTotal = cart.GetTotal(), CartCount = cart.GetCount(), ItemCount = itemCount, DeleteId = id }; return Json(results); }