コード例 #1
0
        public virtual int CreateClient(ClientEntity newClient, IEnumerable <int> identityResourcesIds, IEnumerable <int> grantTypesIds, IEnumerable <int> scopesIds)
        {
            var identityResources = identityResourcesIds == null
                ? null
                : m_identityResourceRepository.GetResourcesById(identityResourcesIds);
            var grantTypes = grantTypesIds == null ? null : m_grantTypeRepository.GetGrantTypesById(grantTypesIds);

            var scopes = scopesIds == null ? null : m_scopeRepository.GetScopesById(scopesIds);

            if (grantTypes != null)
            {
                newClient.AllowedGrantTypes = new HashSet <GrantTypeEntity>(grantTypes);
            }

            if (identityResources != null)
            {
                newClient.AllowedIdentityResources = new HashSet <IdentityResourceEntity>(identityResources);
            }

            if (scopes != null)
            {
                newClient.AllowedScopes = new HashSet <ScopeEntity>(scopes);
            }

            var result = (int)m_clientRepository.Create(newClient);

            return(result);
        }