示例#1
0
        public ActionResult ManagerIndex(string search, string category)
        {
            Restaurant restaurant = restDb.GetRestaurantFull(User.Identity.GetUserId());

            if (restaurant == null)
            {
                return(RedirectToAction("Create", "Restaurants"));
            }
            var userId = User.Identity.GetUserId();

            ViewBag.Categories = new SelectList(pcDb.GetProductCategories(), "Name", "Name");
            IndexProductsVM vm = new IndexProductsVM
            {
                Products   = db.GetProducts(userId, search, category),
                Search     = search,
                Category   = category,
                Categories = pcDb.GetProductCategoriesFull()
            };

            return(View(vm));
        }