public async Task <IActionResult> PutDepartment(int id, Department department) { if (id != department.Id) { return(BadRequest()); } _context.Entry(department).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> UpdateIsControlled(int id, bool value) { var employee = await _context.Employees.FindAsync(id); if (employee == null) { return(NotFound()); } employee.IsControlled = value; await _context.SaveChangesAsync(); return(Ok()); }