public List <User> getUsers() { UserDBContext userdb = new UserDBContext(); List <User> users = userdb.users.ToList(); userdb = null; return(users); }
public void setUsersPassword(string userid, string password) { UserDBContext userdb = new UserDBContext(); List <User> users = userdb.users.ToList(); foreach (User user in users) { if (user.userId == userid) { user.userPassword = password; userdb.SaveChanges(); } } }
//查找用户 public User findUser(string userId) { UserDBContext userdb = new UserDBContext(); List <User> users = userdb.users.ToList(); foreach (User u in users) { if (u.userId == userId) { return(u); } } return(null); }
public void setUsers(string userid, string username, string useremail, string userphone, string password) { UserDBContext userdb = new UserDBContext(); List <User> users = userdb.users.ToList(); foreach (User user in users) { if (user.userId == userid) { user.userName = username; user.userEmail = useremail; user.userPhone = userphone; user.userPassword = password; userdb.SaveChanges(); } } }