Example #1
0
        public async Task <object> Post()
        {
            if (RequestFilteringHelper.IsFeatureEnabled())
            {
                throw new AlreadyExistsException(RequestFilteringHelper.DISPLAY_NAME);
            }

            await RequestFilteringHelper.SetFeatureEnabled(true);

            dynamic settings = RequestFilteringHelper.ToJsonModel(null, null);

            return(Created(RequestFilteringHelper.GetLocation(settings.id), settings));
        }
Example #2
0
        public async Task Delete(string id)
        {
            RequestFilteringId reqId = new RequestFilteringId(id);

            Context.Response.StatusCode = (int)HttpStatusCode.NoContent;

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

            if (site != null)
            {
                var section = RequestFilteringHelper.GetRequestFilteringSection(site, reqId.Path, ManagementUnit.ResolveConfigScope());
                section.RevertToParent();
                ManagementUnit.Current.Commit();
            }

            if (reqId.SiteId == null && RequestFilteringHelper.IsFeatureEnabled())
            {
                await RequestFilteringHelper.SetFeatureEnabled(false);
            }
        }