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); }
public async Task <IActionResult> Search([FromBody] MealFilterModel filterModel) { var meals = await _mealService.GetMealsAsync(User.Identity.Name, filterModel); return(Ok(meals)); }