Example #1
0
        public List <User> getUsers()
        {
            UserDBContext userdb = new UserDBContext();
            List <User>   users  = userdb.users.ToList();

            userdb = null;
            return(users);
        }
Example #2
0
        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();
                }
            }
        }
Example #3
0
        //查找用户
        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);
        }
Example #4
0
        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();
                }
            }
        }