public object Get(string id)
        {
            SslSettingId settingId = new SslSettingId(id);

            // Ssl settings cannot be configured at server level
            if (settingId.SiteId == null)
            {
                return(NotFound());
            }

            Site site = SiteHelper.GetSite(settingId.SiteId.Value);

            return(SslSettingsHelper.ToJsonModel(site, settingId.Path));
        }
        public object Get()
        {
            Site   site = ApplicationHelper.ResolveSite();
            string path = ApplicationHelper.ResolvePath();

            // Ssl settings cannot be configured at server level
            if (site == null)
            {
                return(NotFound());
            }

            dynamic d = SslSettingsHelper.ToJsonModel(site, path);

            return(LocationChanged(SslSettingsHelper.GetLocation(d.id), d));
        }
        public object Patch(string id, [FromBody] dynamic model)
        {
            SslSettingId settingsId = new SslSettingId(id);

            Site site = settingsId.SiteId == null ? null : SiteHelper.GetSite(settingsId.SiteId.Value);

            // Targetting section for a site, but unable to find that site
            if (settingsId.SiteId != null && site == null)
            {
                return(NotFound());
            }

            string configPath = model == null ? null : ManagementUnit.ResolveConfigScope(model);

            SslSettingsHelper.UpdateSettings(model, site, settingsId.Path, configPath);

            ManagementUnit.Current.Commit();

            return(SslSettingsHelper.ToJsonModel(site, settingsId.Path));
        }