Пример #1
0
        public ActionResult Create(string id, ServiceHostParameter model)
        {
            var serviceHost = reader.GetServiceHost(id);

            if (!serviceHost.UserHasAccessTo())
            {
                throw new UnauthorizedAccessException("Access denied to configset");
            }
            ViewBag.HostId = serviceHost.Id;
            var param = reader.CreateServiceHostParameter(serviceHost, model.Name, model.IsSecureString, model.ItemValue, model.IsEnvironmental);

            return(RedirectToAction("Details", "ServiceHosts", new { id = serviceHost.Id }));
        }
Пример #2
0
        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);
            }
        }