@@ -13,6 +13,13 @@ public EmployeeFindQuery (IModelContext modelContext): base (modelContext)
13
13
}
14
14
15
15
public IEnumerable < EmployeeInfo > FindEmployees ( string search , bool teachersOnly , int divisionId )
16
+ {
17
+ return FindEmployees_Internal ( search , teachersOnly , divisionId )
18
+ . Distinct ( new EntityEqualityComparer < EmployeeInfo > ( e => e . EmployeeID ) )
19
+ . OrderBy ( e => e . LastName ) ;
20
+ }
21
+
22
+ IEnumerable < EmployeeInfo > FindEmployees_Internal ( string search , bool teachersOnly , int divisionId )
16
23
{
17
24
// TODO: Reduce code duplication, see also Launchpad/EmployeesTable
18
25
if ( divisionId != - 1 ) {
@@ -29,8 +36,7 @@ public IEnumerable<EmployeeInfo> FindEmployees (string search, bool teachersOnly
29
36
|| e . Phone . Contains ( search )
30
37
|| e . Email . Contains ( search )
31
38
|| e . SecondaryEmail . Contains ( search )
32
- || e . WorkingPlace . Contains ( search ) )
33
- . Distinct ( new EntityEqualityComparer < EmployeeInfo > ( e => e . EmployeeID ) ) ;
39
+ || e . WorkingPlace . Contains ( search ) ) ;
34
40
}
35
41
return ModelContext . Query < EmployeeInfo > ( )
36
42
. IncludePositionsWithDivision ( )
@@ -48,8 +54,7 @@ public IEnumerable<EmployeeInfo> FindEmployees (string search, bool teachersOnly
48
54
|| e . SecondaryEmail . Contains ( search )
49
55
|| e . WorkingPlace . Contains ( search )
50
56
)
51
- . ToList ( )
52
- . Distinct ( new EntityEqualityComparer < EmployeeInfo > ( e => e . EmployeeID ) ) ;
57
+ . ToList ( ) ;
53
58
}
54
59
}
55
60
}
0 commit comments