Ejemplo 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()))
            });
        }