Пример #1
0
        public void Delete(string id)
        {
            SegmentId segId = new SegmentId(id);

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

            if (segId.SiteId != null && site == null)
            {
                Context.Response.StatusCode = (int)HttpStatusCode.NoContent;
                return;
            }

            HiddenSegment segment = HiddenSegmentsHelper.getSegments(site, segId.Path).Where(s => s.Segment.ToString().Equals(segId.Segment)).FirstOrDefault();

            if (segment != null)
            {
                var section = RequestFilteringHelper.GetRequestFilteringSection(site, segId.Path, ManagementUnit.ResolveConfigScope());

                HiddenSegmentsHelper.DeleteSegment(segment, section);
                ManagementUnit.Current.Commit();
            }

            Context.Response.StatusCode = (int)HttpStatusCode.NoContent;
            return;
        }
Пример #2
0
        public object Get()
        {
            string requestFilteringUuid = Context.Request.Query[Defines.IDENTIFIER];

            if (string.IsNullOrEmpty(requestFilteringUuid))
            {
                return(NotFound());
            }

            RequestFilteringId reqId = new RequestFilteringId(requestFilteringUuid);

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

            List <HiddenSegment> segments = HiddenSegmentsHelper.getSegments(site, reqId.Path);

            return(new {
                hidden_segments = segments.Select(s => HiddenSegmentsHelper.ToJsonModelRef(s, site, reqId.Path))
            });
        }
Пример #3
0
        public object Get(string id)
        {
            SegmentId segId = new SegmentId(id);

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

            if (segId.SiteId != null && site == null)
            {
                return(NotFound());
            }

            HiddenSegment segment = HiddenSegmentsHelper.getSegments(site, segId.Path).Where(s => s.Segment.Equals(segId.Segment)).FirstOrDefault();

            if (segment == null)
            {
                return(NotFound());
            }

            return(HiddenSegmentsHelper.ToJsonModel(segment, site, segId.Path));
        }