public async Task <IActionResult> PutEmployee(int id, Employee employee) { if (id != employee.ID) { // Check before call //return BadRequest(); } _context.Entry(employee).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(null); } else { throw; } } return(null); }
public async Task <IActionResult> PutDependent(int id, Dependent dependent) { if (id != dependent.ID) { return(BadRequest()); } _context.Entry(dependent).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DependentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }