public async Task <IEnumerable <PersistedGrantViewModel> > GetPersistedGrants() { var resultado = await _persistedGrantRepository.GetGrants(); var subjects = await _userService.GetByIdAsync(resultado.Select(s => s.SubjectId).ToArray()); return(resultado.Select(s => new PersistedGrantViewModel(s.Key, s.Type, s.SubjectId, s.ClientId, s.CreationTime, s.Expiration, s.Data, subjects.FirstOrDefault(f => f.Id.ToString().ToLower() == s.SubjectId.ToLower())?.Email, subjects.FirstOrDefault(f => f.Id.ToString().ToLower() == s.SubjectId.ToLower())?.Picture))); }
public async Task <ListOfPersistedGrantViewModel> GetPersistedGrants(PagingViewModel paging) { var resultado = await _persistedGrantRepository.GetGrants(paging); var total = await _persistedGrantRepository.Count(); var grants = resultado.Select(s => new PersistedGrantViewModel(s.Key, s.Type, s.SubjectId, s.ClientId, s.CreationTime, s.Expiration, s.Data)); return(new ListOfPersistedGrantViewModel(grants, total)); }
public async Task <ListOfPersistedGrantViewModel> GetPersistedGrants(PagingViewModel paging) { var resultado = await _persistedGrantRepository.GetGrants(paging); var total = await _persistedGrantRepository.Count(); var subjects = await _userService.GetByIdAsync(resultado.Select(s => s.SubjectId).ToArray()); var grants = resultado.Select(s => new PersistedGrantViewModel(s.Key, s.Type, s.SubjectId, s.ClientId, s.CreationTime, s.Expiration, s.Data, subjects.FirstOrDefault(f => f.Id.ToString().ToLower() == s.SubjectId.ToLower())?.Email, subjects.FirstOrDefault(f => f.Id.ToString().ToLower() == s.SubjectId.ToLower())?.Picture)); return(new ListOfPersistedGrantViewModel(grants, total)); }