public ActionResult Details(string id, ServiceHostParameter model) { var par = reader.GetHostParameter(Server.UrlDecode(id)); if (!par.UserHasAccessTo()) { throw new UnauthorizedAccessException("Access denied to configset"); } ViewBag.HostId = par.ServiceHost.Id; par.Description = model.Description; par.IsEnvironmental = model.IsEnvironmental; par.IsSecureString = model.IsSecureString; if (model.ItemValue != par.ItemValue) { if (model.ItemValue.IsNullOrWhiteSpace()) { par.ItemValue = null; } else { par.SetValue(model.ItemValue); } } reader.UpdateHostParameter(par); return(RedirectToAction("Details", "ServiceHosts", new { id = par.ServiceHost.Id })); }
private void SetHostParameter(IConfigSetTask reader, PropertyRequest settings, IServiceHostSettings host) { var item = host.Parameters.SingleOrDefault(p => p.Name == settings.PropertyName); if (item == null) { reader.CreateServiceHostParameter( host, settings.PropertyName, settings.IsSecure, settings.Type == VariableTypes.ServiceHostEnvironmental ? settings.ParentFormatString : settings.Value, settings.Type == VariableTypes.ServiceHostEnvironmental); } else { item.IsSecureString = settings.IsSecure; item.IsEnvironmental = settings.Type == VariableTypes.ServiceHostEnvironmental; item.SetValue( settings.Type == VariableTypes.ServiceHostEnvironmental ? settings.ParentFormatString : settings.Value); reader.UpdateHostParameter(item); } }