예제 #1
0
        [HttpGet("search/{id}")] //shows meal details filtered by category id and same as FindAllMeals()
        public async Task <IActionResult> FindAllMealWithCategoryAsync(Guid id)
        {
            var mealsInfoDB = await _mealRepository.GetAllRecsJoinByCategoryId(id);

            var mealsInfoToReturn = _mapper.Map <IReadOnlyList <MealDetails> >(mealsInfoDB);

            return(mealsInfoDB != null ? (IActionResult)Ok(mealsInfoToReturn) : NotFound("No meals exists for the defined category!"));
        }