void Search() { MyEmployees.Clear(); foreach (var employee in employees .Where(e => e.FirstName.ToLower().Contains(Filter.ToLower()) || e.LastName.ToLower().Contains(Filter.ToLower())) .OrderBy(e => e.FirstName) .ThenBy(e => e.LastName)) { if (employee.EmployeeId != me.EmployeeId) { MyEmployees.Add(new EmployeeItemViewModel { Address = employee.Address, Document = employee.Document, DocumentTypeId = employee.DocumentTypeId, Email = employee.Email, EmployeeCode = employee.EmployeeCode, EmployeeId = employee.EmployeeId, FirstName = employee.FirstName, LastName = employee.LastName, LoginTypeId = employee.LoginTypeId, Phone = employee.Phone, Picture = employee.Picture, }); } } }
void ReloadEmployees() { MyEmployees.Clear(); foreach (var employee in employees .OrderBy(e => e.FirstName) .ThenBy(e => e.LastName)) { if (employee.EmployeeId != me.EmployeeId) { MyEmployees.Add(new EmployeeItemViewModel { Address = employee.Address, Document = employee.Document, DocumentTypeId = employee.DocumentTypeId, Email = employee.Email, EmployeeCode = employee.EmployeeCode, EmployeeId = employee.EmployeeId, FirstName = employee.FirstName, LastName = employee.LastName, LoginTypeId = employee.LoginTypeId, Phone = employee.Phone, Picture = employee.Picture, }); } } }