Beispiel #1
0
        public object Get(string id)
        {
            StaticContentId staticContentId = new StaticContentId(id);

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

            if (staticContentId.SiteId != null && site == null)
            {
                return(NotFound());
            }

            return(StaticContentHelper.ToJsonModel(site, staticContentId.Path));
        }
Beispiel #2
0
        public async Task <object> Post()
        {
            if (StaticContentHelper.IsFeatureEnabled())
            {
                throw new AlreadyExistsException(StaticContentHelper.DISPLAY_NAME);
            }

            await StaticContentHelper.SetFeatureEnabled(true);

            dynamic settings = StaticContentHelper.ToJsonModel(null, null);

            return(Created(StaticContentHelper.GetLocation(settings.id), settings));
        }
Beispiel #3
0
        public object Get()
        {
            Site   site = ApplicationHelper.ResolveSite();
            string path = ApplicationHelper.ResolvePath();

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

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

            return(LocationChanged(StaticContentHelper.GetLocation(d.id), d));
        }
Beispiel #4
0
        public object Patch(string id, [FromBody] dynamic model)
        {
            StaticContentId staticContentId = new StaticContentId(id);

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

            if (staticContentId.SiteId != null && site == null)
            {
                return(NotFound());
            }

            // Check for config_scope
            string configPath            = model == null ? null : ManagementUnit.ResolveConfigScope(model);;
            StaticContentSection section = StaticContentHelper.GetSection(site, staticContentId.Path, configPath);

            StaticContentHelper.UpdateFeatureSettings(model, section);

            ManagementUnit.Current.Commit();

            return(StaticContentHelper.ToJsonModel(site, staticContentId.Path));
        }