Пример #1
0
        public Task <BaseFindResponse <Role> > FindAsync(RoleFindRequest request)
        {
            return(Task.Run(() =>
            {
                var query = context.RolesAsQueryable;
                if (!string.IsNullOrEmpty(request.Name))
                {
                    query = query.Where(a => a.Name.ToLowerInvariant().Contains(request.Name.ToLowerInvariant()));
                }

                var response = query.OrderBy(a => a.Name)
                               .Skip(request.Skip)
                               .Take(request.PageSize)
                               .ToList();

                return new BaseFindResponse <Role>
                {
                    Results = response,
                    TotalRecords = query.Count()
                };
            }));
        }
Пример #2
0
 public Task <BaseFindResponse <Role> > FindAsync(RoleFindRequest request)
 {
     return(_roleRepository.FindAsync(request));
 }