Пример #1
0
        public bool UpdateSiteSettings(SettingsModel updatedSettings)
        {
            var serialized       = JsonConvert.SerializeObject(updatedSettings);
            var selectedSettings = _settingRepository.GetBy(s => s.Key == "SiteSettings");

            if (selectedSettings != null)
            {
                selectedSettings.Value = serialized;
                _settingRepository.Update(selectedSettings);
                _unitOfWork.Commit();
            }
            else
            {
                var settings = new Setting
                {
                    Key   = "SiteSettings",
                    Value = serialized
                };

                _settingRepository.Create(settings);
                _unitOfWork.Commit();
            }

            return(true);
        }