public void AddOrUpdate(ISite site) { var setting = GetSiteSetting(); if (setting == null) { setting = new SiteSetting { SiteName = site.SiteName, BaseUrl = site.BaseUrl, HomePage = site.HomePage, Logo = site.Logo, CopyRight = site.CopyRight, PageSize = site.PageSize, SeoDesc = site.SeoDesc, SeoKeys = site.SeoKeys, SiteSalt = site.SiteSalt, SuperUser = site.SuperUser }; _settingRepository.Create((SiteSetting)setting); } else { setting.SiteName = site.SiteName; setting.BaseUrl = site.BaseUrl; setting.HomePage = site.HomePage; setting.Logo = site.Logo; setting.CopyRight = site.CopyRight; setting.PageSize = site.PageSize; setting.SeoDesc = site.SeoDesc; setting.SeoKeys = site.SeoKeys; setting.SiteSalt = site.SiteSalt; _settingRepository.Update((SiteSetting)setting); } }
public ActionResult Editor(SiteSetting model) { _siteService.AddOrUpdate(model); return RedirectToAction("Index"); }