public IEnumerable<EmployeeModel> FindEmployees(AdminViewSearchModel criteria) { List<EmployeeModel> result = new List<EmployeeModel>(); using (var context = new DB.CrimeCityModel()) result.AddRange(this.transformer.Translate(context.Employees .Where(x=>Apply(criteria, x)))); return result; }
private bool Apply(AdminViewSearchModel criteria, Employee employee) { return !string.IsNullOrEmpty(criteria.FirstName) ? employee.Person.FirstName.Contains(criteria.FirstName) : true && !string.IsNullOrEmpty(criteria.LastName) ? employee.Person.LastName.Contains(criteria.LastName) : true && !criteria.CheckBoxFemale.Equals(criteria.CheckBoxMale) ? criteria.CheckBoxMale == employee.Person.Male : true; }
public AdminViewModel() { SearchCriteria = new AdminViewSearchModel(); SearchResult = new List<EmployeeModel>(); }
public AdminViewModel() { SearchCriteria = new AdminViewSearchModel(); SearchResult = new List <EmployeeModel>(); }