예제 #1
0
 public static List <Language> ListSiteLanguage()
 {
     return(CacheManager.GetOrSetIfNull("SiteListLanguage", () =>
     {
         using (var db = new Implements.CoreDbContext())
         {
             return db.Languages.ToList();
         }
     }));
 }
예제 #2
0
        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);
        }
예제 #3
0
 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();
         }
     }
 }