Please be gentle, I'm a newbie :)
I've got the following DAL2 model for users and their question + answers. In my module the user enters their username and I want to present them with one of their questions, at random, for them to answer. However I'm not sure how to access one of these questions at random.
public class MyUser
{
public int RefID { get; set; }
public int MyUserRef { get; set; }
public string Username { get; set; }
public string Question1 { get; set; }
public string Question2 { get; set; }
public string Question3 { get; set; }
public string Answer1 { get; set; }
public string Answer2 { get; set; }
public string Answer3 { get; set; }
public DateTime CreatedOnDate { get; set; }
public DateTime LastModifiedOnDate { get; set; }
}
For testing, omitting the random part, I can just present one of the questions from my view with:
lblQuestiontoAnswer.Text = curUser.Question1;
I thought about putting all the questions and answers into a string array, then picking one of those array items at random, but got lost in the logic.
Any pointers greatly appreciated.