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(); } }
public static List <UserInfo> GetUsersFromDB() { using (var db = new SQLiteDb()) { return(db.Set <UserInfo>().ToList()); } }
public static void AddUserToDB(UserInfo user) { using (var db = new SQLiteDb()) { db.Set <UserInfo>().Add(user); db.SaveChanges(); } }
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(); } }