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

            Apply(Employees, SearchEmployeeEntity);
            return(Employees.Count());
        }
Example #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());
        }
Example #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());
        }
Example #5
0
 public int Count(EmployeeEntity EmployeeEntity, EmployeeSearchEntity EmployeeSearchEntity)
 {
     return(UnitOfWork.EmployeeRepository.Count(EmployeeSearchEntity));
 }
Example #6
0
 public int Count([FromQuery] EmployeeSearchEntity SearchEmployeeEntity)
 {
     return(EmployeeService.Count(EmployeeEntity, SearchEmployeeEntity));
 }
Example #7
0
 public List <EmployeeEntity> Get([FromQuery] EmployeeSearchEntity SearchEmployeeEntity)
 {
     return(EmployeeService.Get(EmployeeEntity, SearchEmployeeEntity));
 }