Esempio n. 1
0
        public bool AddUser(TransportUser user)
        {
            //only add a user if there is noone else with the same username
            foreach (TransportUser u in _users)
            {
                if (u.GetUsername() == user.GetUsername())
                {
                    return(false);
                }
            }

            _users.Add(user);
            return(true);
        }
Esempio n. 2
0
        public bool AuthoriseUser(string username, string password)
        {
            foreach (TransportUser u in _users)
            {
                //search for the user
                if (username == u.GetUsername())
                {
                    //found user, check password
                    if (password == u.GetPassword())
                    {
                        //log user in
                        _loggedInUser = u;
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            return(false);
        }
Esempio n. 3
0
 public void LogOutUser()
 {
     _loggedInUser = null;
 }