Пример #1
0
        public async Task CreateCollection()
        {
            string databaseName   = ProgramHelper.ReadDatabaseName();
            string collectionName = ProgramHelper.ReadCollectionName();

            ProgramHelper.Divider();
            DocumentCollection documentCollection = await _collectionRepository.CreateCollection(databaseName, collectionName);

            InfoAboutCollection(documentCollection);
        }
Пример #2
0
        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.");
            }
        }
Пример #3
0
        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);
        }