public async Task <IActionResult> PutEmployee([FromRoute] int id, [FromBody] Employee employee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employee.Id) { return(BadRequest()); } _context.Entry(employee).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTodoitems([FromRoute] long id, [FromBody] Todoitems todoitems) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != todoitems.Id) { return(BadRequest()); } _context.Entry(todoitems).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TodoitemsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }