Пример #1
0
        public IActionResult Carte(int id)
        {
            var lesPlats = new List <Plats>();

            try
            {
                RestaurantContext context =
                    HttpContext.RequestServices.GetService(typeof(Restaurant.Models.RestaurantContext)) as
                    RestaurantContext;
                if (id != 0)
                {
                    lesPlats = context.getPlatsByIdCat(id);
                }
                else
                {
                    lesPlats = context.getAllPlats();
                }
            }
            catch (Exception e)
            {
                var monEx = e;
            }

            return(View(lesPlats));
        }