Пример #1
0
        public void 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)
            {
                return;
            }

            StaticContentSection section = StaticContentHelper.GetSection(site, staticContentId.Path, ManagementUnit.ResolveConfigScope());

            section.RevertToParent();

            ManagementUnit.Current.Commit();
        }
Пример #2
0
        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);
            }
        }