Ejemplo n.º 1
0
        public ActionResult CustomerIndex(string id, string search, string category)
        {
            ViewBag.Categories = new SelectList(pcDb.GetProductCategories(), "Name", "Name");
            IndexProductsVM vm = new IndexProductsVM
            {
                Products   = db.GetProducts(id, search, category),
                Search     = search,
                Category   = category,
                Categories = pcDb.GetProductCategories()
            };
            Restaurant restaurant = restDb.GetRestaurant(id);

            ViewBag.Title = $"{restaurant.CompanyName} Menu.";
            return(View(vm));
        }
Ejemplo n.º 2
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));
        }