Exemplo n.º 1
0
        public async Task <IActionResult> Index(string selectedDatabase, string selectedCollection, int index = 0)
        {
            var databasesAndCollections = await _documentService.GetDatabasesAndCollections();

            var viewModel = new ExplorerDbViewModel()
            {
                DatabasesAndCollections = databasesAndCollections,
                Database   = selectedDatabase,
                Collection = selectedCollection,
                Index      = index
            };

            if (selectedCollection != null && selectedDatabase != null)
            {
                viewModel.Document = await _documentService.GetRow(selectedDatabase, selectedCollection, index);

                viewModel.CollectionCount = await _documentService.GetCollectionCount(selectedDatabase, selectedCollection);
            }
            return(View(viewModel));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Index(string selectedDatabase, string selectedCollection, int index = 0)
        {
            System.Diagnostics.Debug.WriteLine("EXECUTING!");
            var databasesAndCollections = await _documentService.GetDatabasesAndCollections();

            System.Diagnostics.Debug.WriteLine(databasesAndCollections.Count);
            var viewModel = new ExplorerDbViewModel()
            {
                DatabasesAndCollections = databasesAndCollections,
                Database   = selectedDatabase,
                Collection = selectedCollection,
                Index      = index
            };

            if (selectedCollection != null && selectedDatabase != null)
            {
                viewModel.Document = await _documentService.GetDocument(selectedDatabase, selectedCollection, index);

                viewModel.CollectionCount = await _documentService.GetCollectionCount(selectedDatabase, selectedCollection);
            }
            return(View(viewModel));
        }