public async Task CreateCollection() { string databaseName = ProgramHelper.ReadDatabaseName(); string collectionName = ProgramHelper.ReadCollectionName(); ProgramHelper.Divider(); DocumentCollection documentCollection = await _collectionRepository.CreateCollection(databaseName, collectionName); InfoAboutCollection(documentCollection); }
public async Task CreateDatabase() { string databaseName = ProgramHelper.ReadDatabaseName(); await _repository.CreateDatabaseAsync(databaseName); bool isDatabaseExist = await _repository.CheckIfDatabaseExistAsync(databaseName); WriteLine("Database >>> " + databaseName + " <<< created."); }
public void ListDatabase() { string databaseName = ProgramHelper.ReadDatabaseName(); List <Database> lstDatabase = _repository.ListDatabaseForAccount(); ProgramHelper.Divider(); foreach (var database in lstDatabase) { WriteLine("Id: " + database.Id); WriteLine("Self link: " + database.SelfLink); WriteLine("User link: " + database.UsersLink); } ProgramHelper.Divider(); }
public async Task DeleteDatabase() { string databaseName = ProgramHelper.ReadDatabaseName(); bool result = await _repository.DeleteDatabase(databaseName); if (result) { WriteLine("Database >>> " + databaseName + " <<< deleted"); } else { WriteLine("Database >>> " + databaseName + " <<< not deleted"); } }
public async Task DeleteCollection() { string databaseName = ProgramHelper.ReadDatabaseName(); string collectionName = ProgramHelper.ReadCollectionName(); bool deleteResult = await _collectionRepository.DeleteCollection(databaseName, collectionName); if (deleteResult) { Success("Collection >>> " + collectionName + " <<< deleted."); } else { Error("Collection >>> " + collectionName + " <<< was not deleted."); } }
public bool InsertCollAndDatabase(ref string databaseName, ref DocumentCollection collectionName) { databaseName = ProgramHelper.ReadDatabaseName(); string collectionId = ProgramHelper.ReadCollectionName(); bool ifCollectionExist = _collectionRepository.CheckIfCollectionExistAsync(databaseName, collectionId); if (ifCollectionExist) { collectionName = _collectionRepository.GetDocumentCollection(databaseName, collectionId); return(true); } collectionName = new DocumentCollection() { Id = collectionId }; return(false); }
public void ReadAllCollectionsFromDatabase() { string databaseName = ProgramHelper.ReadDatabaseName(); _collectionRepository.ReadAllCollections(databaseName).ForEach(t => InfoAboutCollection(t)); }