public async Task <IActionResult> PutRecipe(int id, Recipe recipe) { if (id != recipe.Id) { return(BadRequest()); } _context.Entry(recipe).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RecipeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutIngredient(int id, Ingredient ingredient) { if (id != ingredient.Id) { return(BadRequest()); } _context.Entry(ingredient).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IngredientExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }