public ActionResult NotifyChange(string id, EnvironmentOverview model)
        {
            try
            {
                var env = reader.GetEnvironment(id);
                ViewBag.Name          = env.ConfigSet.Name;
                ViewBag.System        = env.ConfigSet.System;
                ViewBag.EnvironmentId = env.Id;
                ViewBag.Trail         = env.GetTrail();
                reader.PushChange(env.ConfigSet.Id, env.Name);

                try
                {
                    RepositoryFactory.Backup();
                }
                catch (Exception ex)
                {
                    ex.Log();
                }
                return(RedirectToAction("Details", "ConfigSet", new { name = env.ConfigSet.Name, system = env.ConfigSet.System }));
            }
            catch (Exception ex)
            {
                ex.Log();
                throw;
            }
        }
예제 #2
0
 public ActionResult Backup(string id)
 {
     try
     {
         var path    = Path.Combine(ConfigurationManagerHelper.GetValueOnKey("stardust.StoreLocation"), id);
         var tempDir = RepositoryFactory.CreateTempDir(id, path);
         var file    = string.Format("{0}\\{1}.zip", ConfigurationManagerHelper.GetValueOnKey("stardust.StoreLocation"), id);
         var finfo   = RepositoryFactory.Backup(file, tempDir);
         return(File(finfo.FullName, "application/zip, application/octet-stream", string.Format("{0}.zip", id)));
     }
     catch (Exception ex)
     {
         ex.Log();
         var currentStore = RepositoryFactory.GetConnectionString().Split(';').Last().Split('=').Last();
         var lastFile     = Directory.GetFiles(ConfigurationManagerHelper.GetValueOnKey("stardust.StoreLocation")).Where(f => f.Contains(currentStore) && !f.Contains(currentStore + ".zip")).OrderBy(s => s).SingleOrDefault();
         return(File(lastFile, "application/zip, application/octet-stream", string.Format("{0}.zip", id)));
     }
 }