public ActionResult Create(string id, string item, EnvironmentParameter model)
 {
     var env = reader.GetEnvironment(item);
     if (!env.UserHasAccessTo()) throw new UnauthorizedAccessException("Access denied to configset");
     reader.CreatEnvironmentParameter(env, model.Name, model.ItemValue.TrimEnd(), model.IsSecureString);
     ViewBag.EnvironmentId = env.Id;
     return RedirectToAction("Details", "Environment", new { id = "edit", item = env.Id });
 }
 public ActionResult Edit(string id, string item, EnvironmentParameter model)
 {
     var par = reader.GetEnvironmentParameter(item);
     if (!Equals(model.Name, par.Name))
     {
         par.Name = model.Name;
     }
     par.Description = model.Description;
     if (!par.UserHasAccessTo()) throw new UnauthorizedAccessException("Access denied to configset");
     par.IsSecureString = model.IsSecureString;
     if (model.ItemValue != par.ItemValue)
     {
         if (model.ItemValue.IsNullOrWhiteSpace()) par.ItemValue = null;
         else
         {
             par.SetValue(model.ItemValue.TrimEnd());
         }
     }
     reader.UpdateEnvironmentParameter(par);
     return RedirectToAction("Details", "Environment", new { id = "edit", item = par.Environment.Id });
 }