Beispiel #1
0
        public object Get(string id)
        {
            HttpResponseHeadersId headerId = new HttpResponseHeadersId(id);

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

            if (headerId.SiteId != null && site == null)
            {
                return(new StatusCodeResult((int)HttpStatusCode.NotFound));
            }

            return(HttpResponseHeadersHelper.ToJsonModel(site, headerId.Path));
        }
Beispiel #2
0
        public object Get()
        {
            Site   site = ApplicationHelper.ResolveSite();
            string path = ApplicationHelper.ResolvePath();

            if (path == null)
            {
                return(NotFound());
            }

            dynamic d = HttpResponseHeadersHelper.ToJsonModel(site, path);

            return(LocationChanged(HttpResponseHeadersHelper.GetLocation(d.id), d));
        }
Beispiel #3
0
        public object Patch(string id, [FromBody] dynamic model)
        {
            HttpResponseHeadersId headerId = new HttpResponseHeadersId(id);

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

            if (headerId.SiteId != null && site == null)
            {
                return(new StatusCodeResult((int)HttpStatusCode.NotFound));
            }

            // Check for config_scope
            string configScope          = ManagementUnit.ResolveConfigScope(model);;
            HttpProtocolSection section = HttpResponseHeadersHelper.GetSection(site, headerId.Path, configScope);

            HttpResponseHeadersHelper.UpdateFeatureSettings(model, section);

            ManagementUnit.Current.Commit();

            return(HttpResponseHeadersHelper.ToJsonModel(site, headerId.Path));
        }