Esempio n. 1
0
        public object Get()
        {
            string globalRulesId = Context.Request.Query[Defines.IDENTIFIER];

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

            var sectionId = new RewriteId(globalRulesId);

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

            InboundRuleCollection rules = GlobalRulesHelper.GetSection(site, sectionId.Path).InboundRules;

            this.Context.Response.SetItemsCount(rules.Count());

            return(new {
                rules = rules.Select(rule => GlobalRulesHelper.RuleToJsonModelRef((InboundRule)rule, site, sectionId.Path, Context.Request.GetFields()))
            });
        }
        public object Get()
        {
            string inboundRulesId = Context.Request.Query[Defines.IDENTIFIER];

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

            var sectionId = new RewriteId(inboundRulesId);

            // Get site rule is for if applicable
            Site site = sectionId.SiteId == null ? null : SiteHelper.GetSite(sectionId.SiteId.Value);

            InboundRuleCollection rules = InboundRulesHelper.GetSection(site, sectionId.Path).InboundRules;

            // Set HTTP header for total count
            this.Context.Response.SetItemsCount(rules.Count());

            return(new {
                rules = rules.Select(rule => InboundRulesHelper.RuleToJsonModelRef((InboundRule)rule, site, sectionId.Path, Context.Request.GetFields()))
            });
        }