public async Task <IActionResult> Putmeal_plans([FromRoute] int id, [FromBody] meal_plans meal_plans) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != meal_plans.id) { return(BadRequest()); } _context.Entry(meal_plans).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!meal_plansExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Postmeal_plans([FromBody] meal_plans meal_plans) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.meal_plans.Add(meal_plans); await _context.SaveChangesAsync(); return(CreatedAtAction("Getmeal_plans", new { id = meal_plans.id }, meal_plans)); }