Пример #1
0
 public async Task <List <Person> > Handle(GetPersonBySearchTermQuery query)
 {
     return(await _context.Persons
            .Include(x => x.Organisation)
            .Where(x => x.ContactEmail.ToLower().Contains(query.Term.ToLower()))
            .ToListAsync());
 }
        public async Task <List <Person> > Handle(GetPersonBySearchTermQuery query)
        {
            List <Person> results;

            if (_featureFlagConfiguration.EJudFeature)
            {
                results = await(from person in _context.Persons
                                join participant in _context.Participants on person.Id equals participant.PersonId
                                where !excludedRoles.Contains(participant.Discriminator) &&
                                person.ContactEmail.ToLower().Contains(query.Term.ToLower())
                                select person).Distinct().Include(x => x.Organisation).ToListAsync();
            }
            else
            {
                results = await _context.Persons
                          .Include(x => x.Organisation)
                          .Where(x => x.ContactEmail.ToLower().Contains(query.Term.ToLower()))
                          .ToListAsync();
            }

            return(results);
        }