Пример #1
0
        public IActionResult Update([FromBody] SiteConfigurationModel model)
        {
            SiteConfigurationInfo conf = new SiteConfigurationInfo();

            conf.Title                   = model.Title;
            conf.Description             = model.Description;
            conf.HostUrl                 = model.HostUrl;
            conf.CacheActivated          = model.CacheActivated;
            conf.SmtpHost                = model.SmtpHost;
            conf.SmtpPort                = int.Parse(model.SmtpPort);
            conf.SmtpCredentialsUser     = model.SmtpCredentialsUser;
            conf.SmtpCredentialsPassword = model.SmtpCredentialsPassword;
            conf.SmtpEnableSsl           = model.SmtpEnableSsl;
            conf.EmailSender             = model.EmailSender;
            conf.RequireConfirmedEmail   = model.RequireConfirmedEmail;
            conf.Theme                   = model.Theme;
            conf.CookieUsePolicyUrl      = model.CookieUsePolicyUrl;
            conf.ConsentNotice           = model.ConsentNotice;
            conf.CheckConsentNeeded      = model.CheckConsentNeeded;

            // Cache
            if (model.CacheActivated)
            {
                _cacheEngine.EnableCache();
                _cacheEngine.ClearSiteConfig();
            }
            else
            {
                _cacheEngine.DisableCache();
            }

            _parameterManager.SaveSiteConfiguration(conf);
            _cacheEngine.ClearAllCache();

            return(Ok());
        }