public ActionResult UpdateIngredient(int recipeId, int recipeStepId, int id, [FromBody] IngredientForUpdateDto ingredient) { if (!_homeBrewRepository.RecipeExists(recipeId)) { return(NotFound()); } if (!_homeBrewRepository.RecipeStepExists(recipeStepId)) { return(NotFound()); } var ingredientEntity = _homeBrewRepository .GetIngredientForRecipeStep(recipeStepId, id); if (ingredientEntity == null) { return(NotFound()); } _mapper.Map(ingredient, ingredientEntity); _homeBrewRepository.UpdateIngredient(ingredientEntity); _homeBrewRepository.Save(); return(NoContent()); }