Ejemplo n.º 1
0
        [Authorize(Roles = "admin")]//IT`IS WOOOOOOOOOOOOOOOOOOOORK DON`T TOUCH
        public async Task <IActionResult> GetAll()
        {
            IEnumerable <Dish> dishes = await kitchen.GetDishes(); //await db.Dishes.ToListAsync();

            if (dishes != null)
            {
                return(View(dishes));
            }
            return(NotFound());
        }
Ejemplo n.º 2
0
        public IActionResult Index(bool category)//bool Top,bool New)
        {
            IndexViewModel model;

            if (category == false)
            {
                model = new IndexViewModel(service, kitchen);
                return(View(model));
            }
            else
            {
                List <Dish>           ViewDishes   = new List <Dish>();
                List <Product>        ViewProducts = new List <Product>();
                IEnumerable <Dish>    dishes       = kitchen.GetDishes().Result;
                IEnumerable <Product> products     = service.GetProductAll().Result;
                foreach (var item in dishes)
                {
                    if (item.Top == category || item.New == category)
                    {
                        ViewDishes.Add(item);
                    }
                }
                foreach (var item in products)
                {
                    if (item.Top == category || item.New == category)
                    {
                        ViewProducts.Add(item);
                    }
                }
                model = new IndexViewModel
                {
                    Dishes   = ViewDishes,
                    Products = ViewProducts
                };

                return(View(model));
            }
        }
Ejemplo n.º 3
0
 private void GetDishes()
 {
     Dishes = kitchen.GetDishes().Result;
 }