コード例 #1
0
 public static Integration Map(this IntegrationEntity entity)
 {
     return(new Integration
     {
         Id = entity.Id,
         UserId = entity.UserId,
         Provider = entity.Provider,
         Enabled = true,
         Data = entity.ProviderData
     });
 }
コード例 #2
0
        public async Task <Integration> CreateIntegrationAsync(string userId, Provider provider, string providerUserId, IProviderData data)
        {
            Container container = GetIntegrationsContainer();

            var entity = new IntegrationEntity
            {
                Id             = Guid.NewGuid().ToString(),
                UserId         = userId,
                Provider       = provider,
                ProviderUserId = providerUserId,
                ProviderData   = data
            };

            ItemResponse <IntegrationEntity> response = await container.CreateItemAsync(entity, new PartitionKey(entity.UserId));

            return(response.Resource.Map());
        }