//повертає шаблон public ViewResult Index() { var items = _shopcart.GetShopItems(); _shopcart.ListShopItems = items; var obj = new ShopcartViewModel { Shopcart = _shopcart }; return(View(obj)); }
public IActionResult Checkout(Order order) { shopcart.ListShopItems = shopcart.GetShopItems(); //works "IsValid" if all string in Order.cs is correct if (ModelState.IsValid) { allOrders.CreateOrder(order); return(RedirectToAction("Complete")); } if (shopcart.ListShopItems.Count == 0) { ModelState.AddModelError("", "You didn't have any products in your shopcart"); } return(View(order)); }