in Facebook/WebApp/Controllers/DataSourceSetupController.cs [139:167]
public async Task<bool> Update([FromUri] string jobId)
{
PageJobMappingTable = azureTableProvider.GetAzureTableReference(Settings.PageJobMappingTableName);
Expression<Func<PageJobEntity, bool>> filter = (e => e.RowKey == jobId);
List<PageJobEntity> pageJobEntityList = await azureTableProvider.QueryEntitiesAsync<PageJobEntity>(PageJobMappingTable, filter);
PageJobEntity page = pageJobEntityList[0];
string sourceInfo = await sourceProvider.GetAuthTokenForResource(page.PartitionKey, jobId);
PageJobEntity pageJobEntity = new PageJobEntity(page.PartitionKey, jobId);
pageJobEntity.SourceInfo = sourceInfo;
await azureTableProvider.InsertOrReplaceEntityAsync(PageJobMappingTable, pageJobEntity);
Trace.TraceInformation("Job update complete page successfully saved for jobId: {0}", jobId);
try
{
Trace.TraceInformation("Job with JobId: {0} subscribing to webhook", jobId);
await sourceProvider.Subscribe(pageJobEntity.SourceInfo);
Trace.TraceInformation("Job with JobId: {0} successfully subscribed to webhook", jobId);
}
catch (Exception e)
{
Trace.TraceInformation("Job with JobId: {0} subscribed to webhook failed with error: {1}", jobId, e.Message);
return false;
}
return true;
}