public async Task <Subscriptions> CreateSubscriptionAsync(Models.Transfer transfer) { if (transfer == null) { return(null); } var subscription = new Subscriptions { SubscriptionId = Guid.NewGuid(), CustomerId = transfer.CustomerId, TouchPointId = transfer.TargetTouchpointId, Subscribe = true, LastModifiedDate = transfer.LastModifiedDate, }; if (!transfer.LastModifiedDate.HasValue) { subscription.LastModifiedDate = DateTime.Now; } var documentDbProvider = new DocumentDBProvider(); var response = await documentDbProvider.CreateSubscriptionsAsync(subscription); return(response.StatusCode == HttpStatusCode.Created ? (dynamic)response.Resource : (Guid?)null); }
public async Task <Models.Subscriptions> CreateAsync(Models.Subscriptions subscriptions) { if (subscriptions == null) { return(null); } var subscriptionId = Guid.NewGuid(); subscriptions.SubscriptionId = subscriptionId; if (!subscriptions.LastModifiedDate.HasValue) { subscriptions.LastModifiedDate = DateTime.Now; } var documentDbProvider = new DocumentDBProvider(); var response = await documentDbProvider.CreateSubscriptionsAsync(subscriptions); return(response.StatusCode == HttpStatusCode.Created ? (dynamic)response.Resource : (Guid?)null); }