public User getUserById(int userId) { User user = new User(); // get our table data from our DAO userTable = userDAO.GetUserById(userId); //go through table data row by row if (userTable.Count == 1) // their should only be one user { //get data foreach (UserDS.TabUserRow userRow in userTable.Rows) { user.setData(userRow.UID, userRow.UserName, userRow.UserLevel, userRow.UserEmail); } } else { user.Id = -1; } //User will be either fully set or have an id of -1 return(user); }
public List <User> getAllUsers() { List <User> users = new List <User>(); // get our table data from our DAO userTable = userDAO.GetAllUserTab(); //go through table data row by row //get data foreach (UserDS.TabUserRow userRow in userTable.Rows) { User user = new User(); user.setData(userRow.UID, userRow.UserName, userRow.UserLevel, userRow.UserEmail); //add user to list users.Add(user); } return(users); }