public ActionResult <IngredientDto> GetIngredient(int recipeId, int recipeStepId, int id) { if (!_homeBrewRepository.RecipeExists(recipeId)) { _logger.LogInformation($"Recipe with id {recipeId} wasn't found when accessing ingredients"); return(NotFound()); } if (!_homeBrewRepository.RecipeStepExists(recipeStepId)) { _logger.LogInformation($"Recipe step with id {recipeStepId} wasn't found when accessing ingredients"); return(NotFound()); } var ingredient = _homeBrewRepository.GetIngredientForRecipeStep(recipeStepId, id); if (ingredient == null) { return(NotFound()); } return(Ok(_mapper.Map <IngredientDto>(ingredient))); }