public int Count(CustomerSearchEntity SearchCustomerEntity) { if (SearchCustomerEntity == null) { SearchCustomerEntity = new CustomerSearchEntity(); } IQueryable <Customer> Customers = context.Customers; Apply(Customers, SearchCustomerEntity); return(Customers.Count()); }
public List <Customer> List(CustomerSearchEntity SearchCustomerEntity) { if (SearchCustomerEntity == null) { SearchCustomerEntity = new CustomerSearchEntity(); } IQueryable <Customer> Customers = context.Customers; Apply(Customers, SearchCustomerEntity); SkipAndTake(Customers, SearchCustomerEntity); return(Customers.ToList()); }
private IQueryable <Customer> Apply(IQueryable <Customer> Customers, CustomerSearchEntity SearchCustomerEntity) { if (SearchCustomerEntity.Id.HasValue) { Customers = Customers.Where(wh => wh.Id == SearchCustomerEntity.Id.Value); } if (SearchCustomerEntity.CustomerGroupId.HasValue) { Customers = Customers.Where(wh => wh.CustomerGroupId == SearchCustomerEntity.CustomerGroupId.Value); } if (!string.IsNullOrEmpty(SearchCustomerEntity.Username)) { Customers = Customers.Where(T => T.Username.ToLower().Contains(SearchCustomerEntity.Username.ToLower())); } if (!string.IsNullOrEmpty(SearchCustomerEntity.Display)) { Customers = Customers.Where(T => T.Display.ToLower().Contains(SearchCustomerEntity.Display.ToLower())); } if (!string.IsNullOrEmpty(SearchCustomerEntity.FacebookId)) { Customers = Customers.Where(T => T.FacebookId.ToLower().Contains(SearchCustomerEntity.FacebookId.ToLower())); } if (!string.IsNullOrEmpty(SearchCustomerEntity.FacebookEmail)) { Customers = Customers.Where(T => T.FacebookEmail.ToLower().Contains(SearchCustomerEntity.FacebookEmail.ToLower())); } if (!string.IsNullOrEmpty(SearchCustomerEntity.GoogleId)) { Customers = Customers.Where(T => T.GoogleId.ToLower().Contains(SearchCustomerEntity.GoogleId.ToLower())); } if (!string.IsNullOrEmpty(SearchCustomerEntity.GoogleEmail)) { Customers = Customers.Where(T => T.GoogleEmail.ToLower().Contains(SearchCustomerEntity.GoogleEmail.ToLower())); } if (!string.IsNullOrEmpty(SearchCustomerEntity.Picture)) { Customers = Customers.Where(T => T.Picture.ToLower().Contains(SearchCustomerEntity.Picture.ToLower())); } return(Customers); }
public List <CustomerEntity> Get(EmployeeEntity EmployeeEntity, CustomerSearchEntity CustomerSearchEntity) { List <Customer> Customers = UnitOfWork.CustomerRepository.List(CustomerSearchEntity); return(Customers.ToList().Select(c => new CustomerEntity(c)).ToList()); }
public int Count(EmployeeEntity EmployeeEntity, CustomerSearchEntity CustomerSearchEntity) { return(UnitOfWork.CustomerRepository.Count(CustomerSearchEntity)); }
public List <CustomerEntity> Get(CustomerSearchEntity SearchCustomerEntity) { return(CustomerService.Get(EmployeeEntity, SearchCustomerEntity)); }
public long Count(CustomerSearchEntity SearchCustomerEntity) { return(CustomerService.Count(EmployeeEntity, SearchCustomerEntity)); }