private async Task ReplaceProfileDocument(string databaseName, string collectionName, string profileID, Profile updatedProfile) { await this.client.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(databaseName, collectionName, profileID), updatedProfile); this.WriteToConsoleAndPromptToContinue("Replaced Profile {0}", profileID); }
private async Task CreateDocumentIfNotExists(string databaseName, string collectionName, Profile profile) { try { await this.client.ReadDocumentAsync(UriFactory.CreateDocumentUri(databaseName, collectionName, profile.Id)); this.WriteToConsoleAndPromptToContinue("Found {0}", profile.Id); } catch (DocumentClientException de) { if (de.StatusCode == HttpStatusCode.NotFound) { await this.client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(databaseName, collectionName), profile); this.WriteToConsoleAndPromptToContinue("Created Family {0}", profile.Id); } else { throw; } } }