public async Task <IActionResult> PutTimesheet([FromRoute] long id, [FromBody] Timesheet timesheet) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != timesheet.Id) { return(BadRequest()); } _context.Entry(timesheet).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TimesheetExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
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()); }