public ActionResult Settings(SiteSetting newSetting) { var currentSetting = AdminManager.SiteSetting; currentSetting.SiteTitle = newSetting.SiteTitle; currentSetting.Copyright = newSetting.Copyright; currentSetting.Save(); return RedirectToAction("Index", "Home"); }
/// <summary> /// Gets the SiteSetting, if not found it saves a default one. /// </summary> /// <returns></returns> private static SiteSetting _GetSiteSetting() { string key = AdminManager.GetCacheKey_SiteSetting(); SiteSetting setting = SiteCache.Get(key) as SiteSetting; if (setting != null) return setting; setting = new SiteSetting(); Obj obj = AdminManager.GetObject(AdminConfig.SITE_NAVID, AdminConfig.Site_Setting_ObjKey); // if not there, we save a default one, should only happen once if (obj == null) { AdminManager.SaveObject(AdminConfig.SITE_NAVID, AdminConfig.Site_Setting_ObjKey, ObjFormat.Xml, setting); SiteCache.Add(key, setting, new TimeSpan(0, 20, 0)); return setting; } if (obj.Format == ObjFormat.Xml) { setting = (SiteSetting)Serializer.ConvertToObject(obj.Data, typeof(SiteSetting)); } // else if SiteCache.Add(key, setting, new TimeSpan(0, 20, 0)); return setting; }