public ActionResult EditItem(ShoppingCartItem item) { var cart = GetCartForVisitor(); if (cart == null) { return RedirectToAction("Index"); } ShoppingCartItem inCartItem = cart.ShoppingCartItems.First(i => i.ProductId == item.ProductId); if (inCartItem.Quantity != item.Quantity) { ICommand command; if (item.Quantity == 0) { command = new RemoveProductFromShoppingCart(cart.Id, item.ProductId); } else { command = new ChangeProductItemQuantityInShoppingCart(cart.Id, item.ProductId, item.Quantity); } MyShopWebApplication.CommandService.Execute(command); } return RedirectToAction("Index"); }
private void detach_ShoppingCartItems(ShoppingCartItem entity) { this.SendPropertyChanging(); entity.ShoppingCart = null; }
partial void DeleteShoppingCartItem(ShoppingCartItem instance);
partial void UpdateShoppingCartItem(ShoppingCartItem instance);
partial void InsertShoppingCartItem(ShoppingCartItem instance);
private void attach_ShoppingCartItems(ShoppingCartItem entity) { this.SendPropertyChanging(); entity.Product = this; }