public static List <Language> ListSiteLanguage() { return(CacheManager.GetOrSetIfNull("SiteListLanguage", () => { using (var db = new Implements.CoreDbContext()) { return db.Languages.ToList(); } })); }
public static void RefreshListLanguage() { List <Language> listLang; using (var db = new Implements.CoreDbContext()) { listLang = db.Languages.ToList(); } foreach (var l in listLang) { CacheManager.Set("CurrentSiteLanguage_" + l.Id, l); } CacheManager.Set("SiteListLanguage", listLang); }
private static void InitLanguage() { using (var db = new Implements.CoreDbContext()) { var temp = db.Languages.FirstOrDefault(i => i.Id == DefaultLanguageId); if (temp == null) { db.Languages.Add(new Language() { Id = DefaultLanguageId, Code = "En-us", Title = "English", CurrencyCode = "USD", CurrencyExchangeRate = 1 }); db.SaveChanges(); } } }