private IQueryable <Employee> Apply(IQueryable <Employee> Employees, EmployeeSearchEntity SearchEmployeeEntity) { if (SearchEmployeeEntity.Id.HasValue) { Employees = Employees.Where(wh => wh.Id == SearchEmployeeEntity.Id.Value); } if (!string.IsNullOrEmpty(SearchEmployeeEntity.Username)) { Employees = Employees.Where(wh => wh.Username.ToLower().Contains(SearchEmployeeEntity.Username.ToLower())); } if (!string.IsNullOrEmpty(SearchEmployeeEntity.Password)) { Employees = Employees.Where(wh => wh.Password.ToLower().Contains(SearchEmployeeEntity.Password.ToLower())); } if (!string.IsNullOrEmpty(SearchEmployeeEntity.Display)) { Employees = Employees.Where(wh => wh.Display.ToLower().Contains(SearchEmployeeEntity.Display.ToLower())); } if (!string.IsNullOrEmpty(SearchEmployeeEntity.Phone)) { Employees = Employees.Where(wh => wh.Phone.ToLower().Contains(SearchEmployeeEntity.Phone.ToLower())); } if (!string.IsNullOrEmpty(SearchEmployeeEntity.IdentityCard)) { Employees = Employees.Where(wh => wh.IdentityCard.ToLower().Contains(SearchEmployeeEntity.IdentityCard.ToLower())); } if (!string.IsNullOrEmpty(SearchEmployeeEntity.Picture)) { Employees = Employees.Where(wh => wh.Picture.ToLower().Contains(SearchEmployeeEntity.Picture.ToLower())); } return(Employees); }
public int Count(EmployeeSearchEntity SearchEmployeeEntity) { if (SearchEmployeeEntity == null) { SearchEmployeeEntity = new EmployeeSearchEntity(); } IQueryable <Employee> Employees = context.Employees; Apply(Employees, SearchEmployeeEntity); return(Employees.Count()); }
public List <Employee> List(EmployeeSearchEntity SearchEmployeeEntity) { if (SearchEmployeeEntity == null) { SearchEmployeeEntity = new EmployeeSearchEntity(); } IQueryable <Employee> Employees = context.Employees; Apply(Employees, SearchEmployeeEntity); SkipAndTake(Employees, SearchEmployeeEntity); return(Employees.ToList()); }
public List <EmployeeEntity> Get(EmployeeEntity EmployeeEntity, EmployeeSearchEntity EmployeeSearchEntity) { List <Employee> Employees = UnitOfWork.EmployeeRepository.List(EmployeeSearchEntity); return(Employees.ToList().Select(P => new EmployeeEntity(P)).ToList()); }
public int Count(EmployeeEntity EmployeeEntity, EmployeeSearchEntity EmployeeSearchEntity) { return(UnitOfWork.EmployeeRepository.Count(EmployeeSearchEntity)); }
public int Count([FromQuery] EmployeeSearchEntity SearchEmployeeEntity) { return(EmployeeService.Count(EmployeeEntity, SearchEmployeeEntity)); }
public List <EmployeeEntity> Get([FromQuery] EmployeeSearchEntity SearchEmployeeEntity) { return(EmployeeService.Get(EmployeeEntity, SearchEmployeeEntity)); }