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