public ActionResult <IEnumerable <IngredientDto> > GetFullRecipeIngredients(int recipesId) { try { if (!_homeBrewRepository.RecipeExists(recipesId)) { _logger.LogInformation($"Recipe with id {recipesId} wasn't found when accessing ingredients"); return(NotFound()); } var ingredientsForRecipe = _homeBrewRepository.GetIngredientsForRecipe(recipesId); return(Ok(_mapper.Map <IEnumerable <IngredientDto> >(ingredientsForRecipe))); } catch (Exception ex) { _logger.LogCritical($"Exception while getting ingredients for recipe with id {recipesId}.", ex); return(StatusCode(500, "A problem happened while handling your request.")); } }