Beispiel #1
0
 //
 // Summary:
 //     /// Method responsible for searching the data. ///
 //
 // Parameters:
 //   command:
 //     The command param.
 //
 public Task <List <Person> > FindByFilterAsync(PersonFilterCommand command)
 {
     return(_context.Set <Person>()
            .Select(p => p)
            .Where(p => EF.Functions.ILike(p.Email.Value, @$ "%{command.Email}%") ||
                   p.Adresses.Any(x =>
                                  EF.Functions.ILike(x.State, @$ "%{command.State}%") ||
                                  EF.Functions.ILike(x.City, @$ "%{command.City}%")
                                  )
                   )
            .AsNoTracking()
            .ToListAsync());
 }
Beispiel #2
0
        public async Task <IActionResult> Index([FromQuery] PersonFilterCommand command)
        {
            List <Person> list = await _personRepository.FindByFilterAsync(command);

            return(Ok(_mapper.Map <List <Person>, List <PersonResult> >(list)));
        }