Beispiel #1
0
        protected override IQuery <Freelancer> ApplyWhereClause(IQuery <Freelancer> query, FreelancerFilterDTO filter)
        {
            List <IPredicate> predicates = new List <IPredicate>();

            predicates.Add(new SimplePredicate(nameof(Freelancer.UserRole), ValueComparingOperator.Equal, filter.UserRole));

            if (!string.IsNullOrEmpty(filter.SearchedLocation))
            {
                predicates.Add(new SimplePredicate(nameof(Freelancer.Location), ValueComparingOperator.Equal, filter.SearchedLocation));
            }

            if (!string.IsNullOrEmpty(filter.SearchedSex))
            {
                predicates.Add(new SimplePredicate(nameof(Freelancer.Sex), ValueComparingOperator.Equal, filter.SearchedSex));
            }

            if (!string.IsNullOrEmpty(filter.SearchedUserName))
            {
                predicates.Add(new SimplePredicate(nameof(Freelancer.UserName), ValueComparingOperator.Equal, filter.SearchedUserName));
            }

            if (!string.IsNullOrEmpty(filter.SearchedFreelancerName))
            {
                predicates.Add(new SimplePredicate(nameof(Freelancer.Name), ValueComparingOperator.Equal, filter.SearchedFreelancerName));
            }

            return(query.Where(new CompositePredicate(predicates)));
        }
Beispiel #2
0
 protected IQuery <Freelancer> GetAll(IQuery <Freelancer> query, FreelancerFilterDTO filter)
 {
     return(query.Where(new SimplePredicate(nameof(Freelancer.UserRole), ValueComparingOperator.Equal, filter.UserRole)));
 }
 public async Task <QueryResultDTO <FreelancerDTO, FreelancerFilterDTO> > GetFreelancersAsync(FreelancerFilterDTO filter)
 {
     using (UnitOfWorkProvider.Create())
     {
         return(await freelancerService.ListFreelancersAsync(filter));
     }
 }