public async Task <IActionResult> ChangeDepartment(int id) { if (id < 1) { return(BadRequest("Invalid DepartmentID given")); } if (!_repository.IsInDepartment(id)) { return(Unauthorized("You are not allowed to access this resource")); } await _repository.ChangeDepartment(id); return(Ok("Department changed")); }