public ViewResult Index()
        {
            var items = _EFCart.getItems();

            _EFCart.shopItems = items;
            var cartModel = new ShoppingCartViewModel
            {
                efCart = _EFCart
            };

            return(View(cartModel));
        }
示例#2
0
 public IActionResult CheckOut(Order order)
 {
     _efCart.shopItems = _efCart.getItems();
     if (_efCart.shopItems.Count == 0)
     {
         ModelState.AddModelError("", "Нет товаров в корзине");
     }
     if (ModelState.IsValid)
     {
         _orders.CreateOrder(order);
         return(RedirectToAction("Complete"));
     }
     return(View(order));
 }