public IActionResult Checkout(Order order) { _shoppingCard.ShoppingCardItems = _shoppingCard.GetShoppingCardItems(); if (_shoppingCard.ShoppingCardItems.Count == 0) { ModelState.AddModelError("", "Card is empty"); } if (ModelState.IsValid) { _orderRepository.CreateOrder(order); _shoppingCard.ClearCard(); return(RedirectToAction("CheckoutComplete")); } return(View(order)); }
public RedirectToActionResult ClearCart() { _shoppingCard.ClearCard(); return(RedirectToAction("Index")); }