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 async Task Delete(string id) { StaticContentId staticContentId = new StaticContentId(id); Context.Response.StatusCode = (int)HttpStatusCode.NoContent; Site site = (staticContentId.SiteId != null) ? SiteHelper.GetSite(staticContentId.SiteId.Value) : null; if (site != null) { StaticContentSection section = StaticContentHelper.GetSection(site, staticContentId.Path, ManagementUnit.ResolveConfigScope()); section.RevertToParent(); ManagementUnit.Current.Commit(); } if (staticContentId.SiteId == null && StaticContentHelper.IsFeatureEnabled()) { await StaticContentHelper.SetFeatureEnabled(false); } }