public async Task <PagedQuery <IdentityResourceDTO> > SearchAsync(SearchDTO search) { var query = from ir in IdentityResources .Include(c => c.UserClaims) orderby ir.Name select ir; if (!string.IsNullOrWhiteSpace(search.Search)) { query = from obj in query where obj.Name.Contains(search.Search) orderby obj.Name select obj; } var items = await query.Select(s => s.ToDTO()).ToListAsync(); var result = new PagedQuery <IdentityResourceDTO> { Count = search.Count, Items = items, Start = search.Start, Total = items.Count() }; return(result); }
public async Task <IdentityResourceDTO> GetAsync(int id) { var query = from api in IdentityResources .Include(c => c.UserClaims) where api.Id == id select api; var result = await query.FirstOrDefaultAsync(); return(result.ToDTO()); }