Example #1
0
        public ViewResult Index()
        {
            var items = _shopSite.getShopItems();

            _shopSite.listShopItems = items;


            var obj = new ShopSiteViewModel
            {
                shopSite = _shopSite
            };

            return(View(obj));
        }
Example #2
0
        public IActionResult Checkout(Order order)
        {
            shopSite.listShopItems = shopSite.getShopItems();

            if (shopSite.listShopItems.Count == 0)
            {
                ModelState.AddModelError("", "У вас должны быть товары");
            }
            if (ModelState.IsValid)
            {
                allOrders.createOrder(order);
                shopSite.ClearShopitems();
                return(RedirectToAction("Complete"));
            }
            return(View(order));
        }