public object Patch(string id, [FromBody] dynamic model) { SectionId sectionId = new SectionId(id); Site site = sectionId.SiteId == null ? null : SiteHelper.GetSite(sectionId.SiteId.Value); string configScope = ManagementUnit.ResolveConfigScope(model); Configuration configuration = ManagementUnit.GetConfiguration(site?.Id, sectionId.Path, configScope); string location = ManagementUnit.GetLocationTag(site?.Id, sectionId.Path, configScope); string fullSectionPath = $"{DelegationHelper.XPATH}/{sectionId.SectionPath}"; ConfigurationSection section = location == null?configuration.GetSection(fullSectionPath) : configuration.GetSection(fullSectionPath, location); if (section == null) { return(NotFound()); } DelegationHelper.Update(section, model); ManagementUnit.Current.Commit(); // Refresh the section configuration = ManagementUnit.GetConfiguration(site?.Id, sectionId.Path); section = configuration.GetSection(fullSectionPath); return(DelegationHelper.SectionToJsonModel(section, site, sectionId.Path, configScope)); }
public object Get() { Site site = ApplicationHelper.ResolveSite(); string path = ApplicationHelper.ResolvePath(); string configScope = ManagementUnit.ResolveConfigScope(); return(new { sections = DelegationHelper.GetWebServerSections(site, path, configScope) .Select(section => DelegationHelper.SectionToJsonModelRef(section, site, path, configScope)) }); }
public object Get(string id) { SectionId sectionId = new SectionId(id); Site site = sectionId.SiteId == null ? null : SiteHelper.GetSite(sectionId.SiteId.Value); Configuration configuration = ManagementUnit.GetConfiguration(site?.Id, sectionId.Path); ConfigurationSection section = configuration.GetSection($"{DelegationHelper.XPATH}/{sectionId.SectionPath}"); if (section == null) { return(NotFound()); } return(DelegationHelper.SectionToJsonModel(section, site, sectionId.Path, sectionId.ConfigScope)); }