public IActionResult PutMeal([FromRoute] int id, [FromBody] Meal meal) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != meal.MealId) { return(BadRequest()); } try { _mealsService.UpdateMeal(meal); } catch (DbUpdateConcurrencyException) { if (!MealExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }