public ActionResult Create(string id, string item, Environment model)
 {
     
     var cs = configSetTasks.GetConfigSet(item);
     if (!cs.UserHasAccessTo()) throw new UnauthorizedAccessException("Access denied to configset");
     var env = reader.CreatEnvironment(cs, model.Name);
     ViewBag.Name = cs.Name;
     ViewBag.System = cs.System;
     return RedirectToAction("Details", new { id = "edit", item = env.Id });
 }
 public ActionResult Details(string id, string item, Environment model)
 {
     var env = reader.GetEnvironment(item);
     ViewBag.Trail = env.GetTrail();
     if (!env.UserHasAccessTo()) throw new UnauthorizedAccessException("Access denied to configset");
     ViewBag.Name = env.ConfigSet.Name;
     ViewBag.System = env.ConfigSet.System;
     ViewBag.EnvironmentId = env.Id;
     env.Description = model.Description;
     reader.UpdateEnvironment(env);
     return View(env);
 }
        public ActionResult Create(string id, string item, Environment model)
        {
            var cs = configSetTasks.GetConfigSet(item);

            if (!cs.UserHasAccessTo())
            {
                throw new UnauthorizedAccessException("Access denied to configset");
            }
            var env = reader.CreatEnvironment(cs, model.Name);

            ViewBag.Name   = cs.Name;
            ViewBag.System = cs.System;
            return(RedirectToAction("Details", new { id = "edit", item = env.Id }));
        }
        public ActionResult Delete(string id, string item, Environment model)
        {
            var env = reader.GetEnvironment(item);

            reader.DeleteEnvironment(env);
            if (!env.UserHasAccessTo())
            {
                throw new UnauthorizedAccessException("Access denied to configset");
            }
            ViewBag.Name          = env.ConfigSet.Name;
            ViewBag.System        = env.ConfigSet.System;
            ViewBag.EnvironmentId = env.Id;
            return(RedirectToAction("Details", "ConfigSet", new { name = ViewBag.Name, system = ViewBag.System }));
        }
        public ActionResult Details(string id, string item, Environment model)
        {
            var env = reader.GetEnvironment(item);

            ViewBag.Trail = env.GetTrail();
            if (!env.UserHasAccessTo())
            {
                throw new UnauthorizedAccessException("Access denied to configset");
            }
            ViewBag.Name          = env.ConfigSet.Name;
            ViewBag.System        = env.ConfigSet.System;
            ViewBag.EnvironmentId = env.Id;
            env.Description       = model.Description;
            reader.UpdateEnvironment(env);
            return(View(env));
        }
 public ActionResult Delete(string id, string item, Environment model)
 {
     var env = reader.GetEnvironment(item);
     reader.DeleteEnvironment(env);
     if (!env.UserHasAccessTo()) throw new UnauthorizedAccessException("Access denied to configset");
     ViewBag.Name = env.ConfigSet.Name;
     ViewBag.System = env.ConfigSet.System;
     ViewBag.EnvironmentId = env.Id;
     return RedirectToAction("Details", "ConfigSet", new { name = ViewBag.Name, system = ViewBag.System });
 }