public IViewComponentResult Invoke() { var items = _dealerCart.GetDealerCartItems(); _dealerCart.DealerCartItems = items; var model = new DealerCartVM { DealerCart = _dealerCart, CartTotal = _dealerCart.GetCartTotal() }; return(View(model)); }
public IActionResult Index() { var items = _dealerCart.GetDealerCartItems(); _dealerCart.DealerCartItems = items; var model = new DealerCartVM { DealerCart = _dealerCart, CartTotal = _dealerCart.GetCartTotal() }; return(View(model)); }
public IActionResult CheckOut(Order order) { var items = _dealerCart.GetDealerCartItems(); _dealerCart.DealerCartItems = items; int itemsInCartCounter = _dealerCart.DealerCartItems.Count(); if (itemsInCartCounter == 0) { ModelState.AddModelError("", "Your order is empty"); } if (ModelState.IsValid) { _orderRepository.CreateOrder(order); _dealerCart.ClearCart(); return(RedirectToAction(nameof(OrderFullfilled))); } return(View(order)); }