예제 #1
0
 public static List <UserInfo> GetUsersFromDB()
 {
     using (var db = new SQLiteDb())
     {
         return(db.Set <UserInfo>().ToList());
     }
 }
예제 #2
0
 public static void AddUserToDB(UserInfo user)
 {
     using (var db = new SQLiteDb())
     {
         db.Set <UserInfo>().Add(user);
         db.SaveChanges();
     }
 }
예제 #3
0
 public static void SetCheckTime(UserInfo user)
 {
     user.LastCheckTime = DateTime.Now;
     using (var db = new SQLiteDb())
     {
         var model = db.Set <UserInfo>().Where(p => p.UserName == user.UserName).FirstOrDefault();
         model.LastCheckTime = user.LastCheckTime;
         db.SaveChanges();
     }
 }
예제 #4
0
 public static void DelUserFromDB(string userName)
 {
     using (var db = new SQLiteDb())
     {
         var user = db.Set <UserInfo>().Where(p => p.UserName == userName).FirstOrDefault();
         if (user == null)
         {
             return;
         }
         db.Set <UserInfo>().Remove(user);
         db.SaveChanges();
     }
 }