public object Get(string id) { StaticContentId staticContentId = new StaticContentId(id); Site site = staticContentId.SiteId == null ? null : SiteHelper.GetSite(staticContentId.SiteId.Value); if (staticContentId.SiteId != null && site == null) { return(NotFound()); } return(StaticContentHelper.ToJsonModel(site, staticContentId.Path)); }
public async Task <object> Post() { if (StaticContentHelper.IsFeatureEnabled()) { throw new AlreadyExistsException(StaticContentHelper.DISPLAY_NAME); } await StaticContentHelper.SetFeatureEnabled(true); dynamic settings = StaticContentHelper.ToJsonModel(null, null); return(Created(StaticContentHelper.GetLocation(settings.id), settings)); }
public object Get() { Site site = ApplicationHelper.ResolveSite(); string path = ApplicationHelper.ResolvePath(); if (path == null) { return(NotFound()); } dynamic d = StaticContentHelper.ToJsonModel(site, path); return(LocationChanged(StaticContentHelper.GetLocation(d.id), d)); }
public object Patch(string id, [FromBody] dynamic model) { StaticContentId staticContentId = new StaticContentId(id); Site site = staticContentId.SiteId == null ? null : SiteHelper.GetSite(staticContentId.SiteId.Value); if (staticContentId.SiteId != null && site == null) { return(NotFound()); } // Check for config_scope string configPath = model == null ? null : ManagementUnit.ResolveConfigScope(model);; StaticContentSection section = StaticContentHelper.GetSection(site, staticContentId.Path, configPath); StaticContentHelper.UpdateFeatureSettings(model, section); ManagementUnit.Current.Commit(); return(StaticContentHelper.ToJsonModel(site, staticContentId.Path)); }