Example #1
0
        public HttpStatusCode SetConfiguration(LinkedNodesConfigModel config)
        {
            try
            {
                Configuration linkedNodesConfig = _configHelper.GetConfigurationFile();

                AppSettingsSection appSettings = (linkedNodesConfig.GetSection("appSettings") as AppSettingsSection);

                appSettings.Settings["overview.showId"].Value            = config.OverviewShowId == true ? "true" : "false";
                appSettings.Settings["overview.showPath"].Value          = config.OverviewShowPath == true ? "true" : "false";
                appSettings.Settings["overview.showPropertyAlias"].Value =
                    config.OverviewShowPropertyAlias == true ? "true" : "false";
                appSettings.Settings["events.preventDeletionOfLinkedContentNodes"].Value =
                    config.EventsPreventDeletionOfLinkedContentNodes == true ? "true" : "false";
                appSettings.Settings["events.preventDeletionOfLinkedMediaNodes"].Value =
                    config.EventsPreventDeletionOfLinkedMediaNodes == true ? "true" : "false";

                linkedNodesConfig.Save(ConfigurationSaveMode.Modified);

                return(HttpStatusCode.OK);
            }
            catch (Exception ex)
            {
                Logger.Error <LinkedNodesContentAppInstallApiController>(ex);
                return(HttpStatusCode.InternalServerError);
            }
        }
Example #2
0
        public LinkedNodesConfigModel GetConfiguration()
        {
            try
            {
                Configuration linkedNodesConfig = _configHelper.GetConfigurationFile();

                AppSettingsSection appSettings = (linkedNodesConfig.GetSection("appSettings") as AppSettingsSection);

                LinkedNodesConfigModel config = new LinkedNodesConfigModel()
                {
                    OverviewShowId            = appSettings.Settings["overview.showId"].Value == "true",
                    OverviewShowPath          = appSettings.Settings["overview.showPath"].Value == "true",
                    OverviewShowPropertyAlias = appSettings.Settings["overview.showPropertyAlias"].Value == "true",
                    EventsPreventDeletionOfLinkedContentNodes = appSettings.Settings["events.preventDeletionOfLinkedContentNodes"].Value == "true",
                    EventsPreventDeletionOfLinkedMediaNodes   = appSettings.Settings["events.preventDeletionOfLinkedMediaNodes"].Value == "true"
                };
                return(config);
            } catch (Exception ex)
            {
                Logger.Error <LinkedNodesContentAppInstallApiController>(ex);
                return(null);
            }
        }