Пример #1
0
        public async Task <IActionResult> Insert()
        {
            QueryResponse <FoodCategory> categories = await foodCategoryService.GetAll();

            QueryResponse <Food> foods = await foodService.GetAll();

            QueryResponse <Meal> meals = await mealService.GetAll();

            ViewBag.Path       = environment.ContentRootPath + "//wwwroot//img//refeicao//";
            ViewBag.Categories = categories.Data;
            ViewBag.Foods      = foods.Data;
            ViewBag.Meals      = meals.Data;

            return(View());
        }
        // GET: Meal
        public ActionResult Index()
        {
            var model = new MealViewModel
            {
                Meals = _mealService.GetAll()
            };

            return(View(model));
        }
Пример #3
0
        // GET: Home
        public ActionResult Index()
        {
            var model = new HomeViewModel
            {
                Categories = _categoryService.GetAll(),
                Meals      = _mealService.GetAll()
            };

            return(View(model));
        }
Пример #4
0
        public IActionResult GetAll()
        {
            var result = mealManager.GetAll();

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Пример #5
0
        public ActionResult GetGridData(GridParams g, bool?restore)
        {
            var isAdmin = WebUtils.IsUserAdmin();

            var data = service.GetAll(isAdmin);

            if (restore.HasValue && isAdmin)
            {
                OnCrud(ChangeType.Edit);
                service.Restore(Convert.ToInt32(g.Key));
            }

            var model = new GridModelBuilder <Meal>(data, g)
            {
                KeyProp = o => o.Id,
                Map     = o => new { o.Id, o.Name, o.Comments, o.Picture, o.IsDeleted },
                GetItem = () => service.Get(Convert.ToInt32(g.Key))
            }.Build();

            return(Json(model));
        }
Пример #6
0
        public IActionResult GetAll()
        {
            var meals = _mealService.GetAll();

            return(Ok(meals));
        }
        [HttpGet][Route("")] public IActionResult GetAll()
        {
            var meals = _mealService.GetAll();

            return(Ok(meals));
        }
Пример #8
0
        public async Task <IActionResult> GetAllMeals()
        {
            var result = await _mealService.GetAll();

            return(Ok(result));
        }
 public List <Meal> Get()
 {
     return(_mealService.GetAll());
 }