public async Task <IHttpActionResult> GetDepartment(int id) { try { Department department = await _repository.FindAsync(id); if (department == null) { return(NotFound()); } return(Ok(department)); } catch (Exception ex) { return(InternalServerError(ex)); } }