Example #1
0
        public virtual void UpdateApiResource(int id, ApiResourceEntity apiResource, IEnumerable <int> claimsIds)
        {
            var apiResourceEntity = m_apiResourceRepository.FindApiResourceById(id);

            if (apiResourceEntity == null)
            {
                throw new NoResultException <ApiResourceEntity>();
            }

            apiResourceEntity.Name                    = apiResource.Name;
            apiResourceEntity.Description             = apiResource.Description;
            apiResourceEntity.Required                = apiResource.Required;
            apiResourceEntity.ShowInDiscoveryDocument = apiResource.ShowInDiscoveryDocument;

            apiResourceEntity.ClaimTypes =
                new HashSet <ClaimTypeEntity>(m_claimTypeRepository.GetClaimTypesById(claimsIds));
            m_apiResourceRepository.Update(apiResourceEntity);
        }