private static async Task <ManagedAppSubscriberInfo> SaveSubscriberAsync(Notification data, ILogger log) { try { var container = await GetContainerAsync(); var record = ManagedAppSubscriberInfo.FromNotification(data); await container.UpsertItemAsync <ManagedAppSubscriberInfo>(record, new PartitionKey(record.Product)); return(record); } catch (Exception ex) { log.LogError(ex, "Issue saving subscription info"); return(null); } }
private static async Task <bool> RemoveSubscriber(Notification data, ILogger log) { try { var container = await GetContainerAsync(); var record = ManagedAppSubscriberInfo.FromNotification(data); await container.DeleteItemAsync <ManagedAppSubscriberInfo>(record.Id, new PartitionKey(record.Product)); return(true); } catch (Exception ex) { log.LogError(ex, "Issue saving subscription info"); return(false); } }