Exemplo n.º 1
0
        /// <summary>
        /// Change Selected Tenant of the RollBack page
        /// </summary>
        /// <param name="selectedTenant"></param>
        /// <returns></returns>
        public ActionResult RollBackReload(string selectedTenant)
        {
            //Similar as RollBack() except the active tenant is defined by user driven input
            var collection = new TenantSnapShots();
            var SnapShotDirectory = GetWebConfigValues("LocalSnapShotDirectory");

            collection.Tenants = GetTenantList(SnapShotDirectory);
            collection.CommentsByTenant = GetSnapShotsByTenant(SnapShotDirectory, selectedTenant);
            foreach (var tenant in collection.Tenants)
            {
                if (tenant.tenantName == selectedTenant)
                {
                    tenant.selected = true;
                }
            }

            return View("RollBack", collection);
        }
Exemplo n.º 2
0
        /// <summary>
        /// RollBack Page
        /// </summary>
        /// <returns></returns>
        public ActionResult RollBack()
        {
            //Collect is a model to be used by the VMC view
            var collection = new TenantSnapShots();
            var SnapShotDirectory = GetWebConfigValues("LocalSnapShotDirectory");

            //Get the tenants that have a saved SnapShots
            collection.Tenants = GetTenantList(SnapShotDirectory);

            //Get the SnapShots available for the active tenant
            //In this case, set the first returned tenant as active until the use selects a differnet tenant in the MVC view
            collection.CommentsByTenant = GetSnapShotsByTenant(SnapShotDirectory, collection.Tenants[0].tenantName);//);
            collection.Tenants[0].selected = true;

            //Load RollBack page
            return View(collection);
        }
Exemplo n.º 3
0
        /// <summary>
        /// RollBack the user Selected Tenant
        /// </summary>
        /// <param name="currentTenant"></param>
        /// <param name="selectedSnapShot"></param>
        /// <returns></returns>
        public ActionResult RollBackExecute(string currentTenant, string selectedSnapShot)
        {
            //Same as RollBack() except the selected snapshot is used to trigger a the RollBackTenant method
            var collection = new TenantSnapShots();
            var SnapShotDirectory = GetWebConfigValues("LocalSnapShotDirectory");

            collection.Tenants = GetTenantList(SnapShotDirectory);
            collection.CommentsByTenant = GetSnapShotsByTenant(SnapShotDirectory, currentTenant);
            foreach (var tenant in collection.Tenants)
            {
                if (tenant.tenantName == currentTenant)
                {
                    tenant.selected = true;

                    RollBackTenant(tenant.tenantName, selectedSnapShot, SnapShotDirectory);

                }
            }

            return View("RollBack", collection);
        }
Exemplo n.º 4
0
        /// <summary>
        /// This does nothing yet!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        /// Potential feature expansion - providing uses with the ability to delete unwanted SnapShots
        /// </summary>
        /// <param name="selectedTenant"></param>
        /// <param name="selectedSnapShot"></param>
        /// <returns></returns>
        public ActionResult DeleteSnapShot(string selectedTenant, string selectedSnapShot)
        {
            var collection = new TenantSnapShots();
            var SnapShotDirectory = GetWebConfigValues("LocalSnapShotDirectory");
            //var tenantModelFromApic = ApicGetRequest("api/node/class/fvTenant.json?");
            string[] filesToDelete = Directory.GetFiles(SnapShotDirectory, selectedTenant + "----" + selectedSnapShot);
            foreach (var file in filesToDelete)
            {
                if (System.IO.File.Exists(file))

                {
                    System.IO.File.Delete(file);
                }
            }

            collection.Tenants = GetTenantList(SnapShotDirectory);
            collection.CommentsByTenant = GetSnapShotsByTenant(SnapShotDirectory, selectedTenant);
            foreach (var tenant in collection.Tenants)
            {
                if (tenant.tenantName == selectedTenant)
                {
                    tenant.selected = true;

                }
            }

            return View("RollBack", collection);
        }