Example #1
0
        public async Task <Person> HandleAsync(OnePersonQuery query, CancellationToken cancellationToken = default)
        {
            var _ = await provider.GetQueryableAsync(query, cancellationToken);

            var ret = _.First(t => t.Id == query.PersonId);

            return(ret);
        }
Example #2
0
        public async Task <IQueryable <Person> > HandleAsync(PersonQuery query, CancellationToken cancellationToken = default)
        {
            var ret = await queryableProvider.GetQueryableAsync(query);

            if (query != null && !string.IsNullOrEmpty(query.Search))
            {
                ret = ret.Where(t => t.FirstName.Contains(query.Search) || t.LastName.Contains(query.Search));
            }

            return(ret);
        }
Example #3
0
        public async Task <List <Person> > HandleAsync(ListPersonQuery query, CancellationToken cancellationToken = default)
        {
            var _ = await provider.GetQueryableAsync(query, cancellationToken);

            if (query.Search != null)
            {
                _ = _
                    .Where(t => t.FirstName.Contains(query.Search, StringComparison.InvariantCultureIgnoreCase) ||
                           t.LastName.Contains(query.Search, StringComparison.InvariantCultureIgnoreCase));
            }


            var ret = _.ToList();

            return(ret);
        }