public RedirectToRouteResult RemoveFromCart(Cart cart,int productId, string returnUrl) { Product product = repository.Products.FirstOrDefault(p => p.ProductID == productId); if (product != null) { cart.RemoveLine(product); } return RedirectToAction("Index", new { returnUrl }); }
public RedirectToRouteResult RemoveFromCart(Cart cart, int itemId, string returnUrl) { Item item = repository.Items .FirstOrDefault(it => it.ItemId == itemId); if (item != null) { cart.RemoveLine(item); } return RedirectToAction("Index", new { returnUrl }); }
public async Task<RedirectToRouteResult> RemoveFromCart(Cart cart, string productId, string returnUrl) { Product product = await repository.GetProductById(productId); if (product != null) { cart.RemoveLine(product); } return RedirectToAction("Index", new { returnUrl }); }
public RedirectToRouteResult RemoveFromCart(Cart cart, int productId) { Product product = repository.Products.FirstOrDefault(p => p.ProductID == productId); if (product != null) cart.RemoveLine(product); return RedirectToAction("Index", new { app_culture = ControllerContext.RequestContext.RouteData.Values["app_culture"] }); }