示例#1
0
 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);
 }
示例#2
0
        public int Count(EmployeeSearchEntity SearchEmployeeEntity)
        {
            if (SearchEmployeeEntity == null)
            {
                SearchEmployeeEntity = new EmployeeSearchEntity();
            }
            IQueryable <Employee> Employees = context.Employees;

            Apply(Employees, SearchEmployeeEntity);
            return(Employees.Count());
        }
示例#3
0
        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());
        }
示例#4
0
        public List <EmployeeEntity> Get(EmployeeEntity EmployeeEntity, EmployeeSearchEntity EmployeeSearchEntity)
        {
            List <Employee> Employees = UnitOfWork.EmployeeRepository.List(EmployeeSearchEntity);

            return(Employees.ToList().Select(P => new EmployeeEntity(P)).ToList());
        }
示例#5
0
 public int Count(EmployeeEntity EmployeeEntity, EmployeeSearchEntity EmployeeSearchEntity)
 {
     return(UnitOfWork.EmployeeRepository.Count(EmployeeSearchEntity));
 }
示例#6
0
 public int Count([FromQuery] EmployeeSearchEntity SearchEmployeeEntity)
 {
     return(EmployeeService.Count(EmployeeEntity, SearchEmployeeEntity));
 }
示例#7
0
 public List <EmployeeEntity> Get([FromQuery] EmployeeSearchEntity SearchEmployeeEntity)
 {
     return(EmployeeService.Get(EmployeeEntity, SearchEmployeeEntity));
 }