예제 #1
0
        public async Task <Resources> GetAllResourcesAsync()
        {
            var identityResources = await _identityResourceService.GetAll();

            var apiResources = await _apiResourceService.GetAll();

            List <IdentityResource> identities = new List <IdentityResource>();
            List <ApiResource>      apis       = new List <ApiResource>();

            if (identityResources.IsSuccess &&
                identityResources.Data != null &&
                identityResources.Data.Any())
            {
                identities.AddRange(_mapper.Map <IEnumerable <IdentityResourceDto>, IEnumerable <IdentityResource> >(identityResources.Data));
            }

            if (apiResources.IsSuccess &&
                apiResources.Data != null &&
                apiResources.Data.Any())
            {
                apis.AddRange(_mapper.Map <IEnumerable <ApiResourceDto>, IEnumerable <ApiResource> >(apiResources.Data));
            }

            return(new Resources(identities, apis));
        }