Beispiel #1
0
        public object Get()
        {
            string outboundRulesId = Context.Request.Query[Defines.IDENTIFIER];

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

            var sectionId = new RewriteId(outboundRulesId);

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

            OutboundRulesCollection rules = OutboundRulesHelper.GetSection(site, sectionId.Path).Rules;

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

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