コード例 #1
0
        public IActionResult Update(SiteSettingViewModel siteSetting, MailSettingViewModel mailSetting, SSOSettingViewModel SSOSetting)
        {
            var currentSiteSetting = _siteSettingRepository.Single();
            var currentMailSetting = _mailSettingRepository.Single();
            var currentSsoSetting  = _ssoSettingRepository.Single();

            if (currentSiteSetting == null)
            {
                currentSiteSetting = new Domain.Application.Entities.SiteSetting()
                {
                    Id = Guid.NewGuid().ToString()
                };
                _siteSettingRepository.Add(currentSiteSetting);
            }
            else
            {
                _siteSettingRepository.Update(currentSiteSetting);
            }
            if (currentMailSetting == null)
            {
                currentMailSetting = new Domain.Application.Entities.MailSetting()
                {
                    Id = Guid.NewGuid().ToString()
                };
                _mailSettingRepository.Add(currentMailSetting);
            }
            else
            {
                _mailSettingRepository.Update(currentMailSetting);
            }
            if (currentSsoSetting == null)
            {
                currentSsoSetting = new Domain.Application.Entities.SSOSetting()
                {
                    Id = Guid.NewGuid().ToString()
                };
                _ssoSettingRepository.Add(currentSsoSetting);
            }
            else
            {
                _ssoSettingRepository.Update(currentSsoSetting);
            }
            PropertyCopy.Copy(siteSetting, currentSiteSetting);
            PropertyCopy.Copy(mailSetting, currentMailSetting);
            PropertyCopy.Copy(SSOSetting, currentSsoSetting);
            _siteSettingRepository.Save(RequestContext);
            _configuration.SetConfiguration();

            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public IActionResult Update(SiteSettingViewModel siteSetting, MailSettingViewModel mailSetting, SSOSettingViewModel SSOSetting)
        {
            var CurrentSiteSetting = siteSettingRepository.Single();
            var CurrentMailSetting = mailSettingRepository.Single();
            var CurrentSSOSetting  = SSOSettingRepository.Single();

            if (CurrentSiteSetting == null)
            {
                CurrentSiteSetting = new Domain.Application.Entities.SiteSetting()
                {
                    Id = Guid.NewGuid().ToString()
                };
                siteSettingRepository.Add(CurrentSiteSetting);
            }
            else
            {
                siteSettingRepository.Update(CurrentSiteSetting);
            }
            if (CurrentMailSetting == null)
            {
                CurrentMailSetting = new Domain.Application.Entities.MailSetting()
                {
                    Id = Guid.NewGuid().ToString()
                };
                mailSettingRepository.Add(CurrentMailSetting);
            }
            else
            {
                mailSettingRepository.Update(CurrentMailSetting);
            }
            if (CurrentSSOSetting == null)
            {
                CurrentSSOSetting = new Domain.Application.Entities.SSOSetting()
                {
                    Id = Guid.NewGuid().ToString()
                };
                SSOSettingRepository.Add(CurrentSSOSetting);
            }
            else
            {
                SSOSettingRepository.Update(CurrentSSOSetting);
            }
            PropertyCopy.Copy(siteSetting, CurrentSiteSetting);
            PropertyCopy.Copy(mailSetting, CurrentMailSetting);
            PropertyCopy.Copy(SSOSetting, CurrentSSOSetting);
            siteSettingRepository.Save(requestContext);
            configuration.SetConfiguration();

            return(RedirectToAction("Index"));
        }