Exemplo n.º 1
0
 public bool CheckInstall(GlobalSettings s)
 {
     try
     {
         using (var session = docStore.OpenSession())
         {
             var results = session.Query <WritaPost>().Count();
             if (results == 0)
             {
                 InstallSet set = InstallHelper.GetInstall();
                 CreatePost(set.homepage);
                 CreatePost(set.firstpost);
                 //db.WritaSettings.Add(set.settings);
                 //db.SaveChanges();
                 using (var f = docStore.OpenSession())
                 {
                     f.Store(set.settings);
                     f.SaveChanges();
                 }
                 //install.
             }
             session.SaveChanges();
             System.Threading.Thread.Sleep(3000);
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 2
0
 public bool CheckInstall(GlobalSettings s)
 {
     try
     {
         server.Ping();
         if (!database.GetCollection <WritaPost>("Posts").Exists())
         {
             InstallSet set = InstallHelper.GetInstall();
             CreatePost(set.homepage);
             CreatePost(set.firstpost);
             database.GetCollection <WritaSettings>("Settings").Save(set.settings);
             //install.
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 3
0
 public bool CheckInstall(GlobalSettings s)
 {
     try
     {
         using (var db = new WritaBlogContext())
         {
             if (db.WritaPosts.Count() == 0)
             {
                 InstallSet set = InstallHelper.GetInstall();
                 CreatePost(set.homepage);
                 CreatePost(set.firstpost);
                 db.WritaSettings.Add(set.settings);
                 db.SaveChanges();
                 //install.
             }
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }