Exemplo n.º 1
0
        public async Task <List <Meal> > GetMealsAsync(string userId, MealFilterModel filterModel)
        {
            var query = _repository.GetAll <Meal>().Where(x => x.UserId == userId).OrderBy(x => x.Date);

            var result = await _filter.Filter(filterModel, query).ToListAsync();

            return(result);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Search([FromBody] MealFilterModel filterModel)
        {
            var meals = await _mealService.GetMealsAsync(User.Identity.Name, filterModel);

            return(Ok(meals));
        }