/// <summary> /// 主题设置添加 /// </summary> /// <param name="mTheme">主题设置实体</param> public void AddTheme(Himall.Model.ThemeInfo mTheme) { string imgUrl = string.Empty; var data = Context.ThemeInfo.ToList(); if (data.Count == 0) { Context.ThemeInfo.Add(mTheme); Context.SaveChanges(); Core.Cache.Remove(CacheKeyCollection.Themes);//清除缓存 } }
/// <summary> /// 主题设置数据更改 /// </summary> /// <param name="mTheme">主题设置实体</param> public void UpdateTheme(Himall.Model.ThemeInfo mTheme) { var model = Context.ThemeInfo.FirstOrDefault(s => s.ThemeId == mTheme.ThemeId); model.TypeId = mTheme.TypeId; model.WritingColor = mTheme.WritingColor; model.SecondaryColor = mTheme.SecondaryColor; model.MainColor = mTheme.MainColor; model.FrameColor = mTheme.FrameColor; model.ClassifiedsColor = mTheme.ClassifiedsColor; Context.SaveChanges(); Core.Cache.Remove(CacheKeyCollection.Themes);//清除缓存 }