public ActionResult Last(Quest.MasterPricing.Database.Models.TablesListViewModel tablesListViewModel)
        {
            questStatus status = null;

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Log Operation
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = LogOperation();
            if (!questStatusDef.IsSuccess(status))
            {
                status = new questStatus(Severity.Success);
                tablesListViewModel.questStatus = status;
                return(Json(tablesListViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(tablesListViewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                status = new questStatus(Severity.Success);
                tablesListViewModel.questStatus = status;
                return(Json(tablesListViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Get list of items.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            DatabaseId databaseId = new DatabaseId(tablesListViewModel.DatabaseId);

            Quest.MasterPricing.Database.Models.TablesListViewModel tablesetsListViewModelNEW = null;
            TablesListModeler tablesListModeler = new TablesListModeler(this.Request, this.UserSession);

            status = tablesListModeler.List(databaseId, out tablesetsListViewModelNEW);
            if (!questStatusDef.IsSuccess(status))
            {
                status = new questStatus(Severity.Success);
                tablesListViewModel.questStatus = status;
                return(Json(tablesListViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return view
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = new questStatus(Severity.Success);
            tablesetsListViewModelNEW.DatabaseId  = tablesListViewModel.DatabaseId;
            tablesetsListViewModelNEW.questStatus = status;
            return(Json(tablesetsListViewModelNEW, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Index(DatabaseEditorViewModel databaseEditorViewModel)
        {
            questStatus status = null;

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Log Operation
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = LogOperation();
            if (!questStatusDef.IsSuccess(status))
            {
                databaseEditorViewModel.questStatus = status;
                return(View("Index", databaseEditorViewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(databaseEditorViewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                databaseEditorViewModel.questStatus = status;
                return(View("Index", databaseEditorViewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Read the database info.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            DatabaseId            databaseId            = new DatabaseId(databaseEditorViewModel.Id);
            DatabaseBaseViewModel databaseBaseViewModel = null;
            DatabaseBaseModeler   databaseBaseModeler   = new DatabaseBaseModeler(this.Request, this.UserSession);

            status = databaseBaseModeler.GetDatabase(databaseId, out databaseBaseViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                databaseEditorViewModel.questStatus = status;
                return(View("Index", databaseEditorViewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return view.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            Quest.MasterPricing.Database.Models.TablesListViewModel tablesListViewModel = new Quest.MasterPricing.Database.Models.TablesListViewModel(this.UserSession, databaseEditorViewModel);
            tablesListViewModel.DatabaseId = databaseBaseViewModel.Id;
            tablesListViewModel.Database   = databaseBaseViewModel;
            return(View(tablesListViewModel));
        }