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); }
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); }
public void LogOutUser() { _loggedInUser = null; }