public object Get() { RewriteHelper.ResolveRewrite(Context, out Site site, out string path); if (path == null) { return(NotFound()); } dynamic d = InboundRulesHelper.SectionToJsonModel(site, path); return(LocationChanged(InboundRulesHelper.GetSectionLocation(d.id), d)); }
public object Get(string id) { var rewriteId = new RewriteId(id); Site site = rewriteId.SiteId == null ? null : SiteHelper.GetSite(rewriteId.SiteId.Value); if (rewriteId.SiteId != null && site == null) { Context.Response.StatusCode = (int)HttpStatusCode.NotFound; return(null); } return(InboundRulesHelper.SectionToJsonModel(site, rewriteId.Path)); }
public object Patch(string id, [FromBody] dynamic model) { if (model == null) { throw new ApiArgumentException("model"); } RewriteId inboundRulesId = new RewriteId(id); Site site = inboundRulesId.SiteId == null ? null : SiteHelper.GetSite(inboundRulesId.SiteId.Value); if (inboundRulesId.SiteId != null && site == null) { return(NotFound()); } string configPath = model == null ? null : ManagementUnit.ResolveConfigScope(model); InboundRulesHelper.UpdateSection(model, site, inboundRulesId.Path, configPath); ManagementUnit.Current.Commit(); return(InboundRulesHelper.SectionToJsonModel(site, inboundRulesId.Path)); }