//[AuthorizationFilter("User")] public IActionResult ListPool(NumJuror model) { int numberOfJurors = model.numberOfJurors; JurySQLDAO jurySQLDAO = new JurySQLDAO(); JuryPool jury = new JuryPool(); int rows = jurySQLDAO.GetRows(); RandomID randomID = new RandomID(); for (int i = 0; i < numberOfJurors; i++) { Juror juror = new Juror(); juror = jurySQLDAO.GetJuror(randomID.getRandomID(rows)); jury.Pool.Add(juror); } return(View(jury)); }
public IActionResult ListPool(int numberOfJurors) { //added temp data to ensure working code //int numberOfJurors = numJuror.numberOfJurors; JurySQLDAO jurySQLDAO = new JurySQLDAO(); numberOfJurors = 7; JuryPool jury = new JuryPool(); int rows = jurySQLDAO.GetRows(); RandomID randomID = new RandomID(); for (int i = 0; i < numberOfJurors; i++) { Juror juror = new Juror(); juror = jurySQLDAO.GetJuror(randomID.getRandomID(rows)); jury.Pool.Add(juror); } return(View(jury)); }
static void Main(string[] args) { Console.WriteLine("Please enter the number of Jurors need for this pool:"); string temp = Console.ReadLine(); int numberOfJurors; bool success = Int32.TryParse(temp, out numberOfJurors); if (success) { numberOfJurors = int.Parse(temp); JuryPool juryPool = new JuryPool(); JurySQLDAO juryDAO = new JurySQLDAO(); RandomID randomID = new RandomID(); int numberOfRows = juryDAO.GetRows(); for (int i = 0; i < numberOfJurors; i++) { Juror juror = new Juror(); juror = juryDAO.GetJuror(randomID.getRandomID(numberOfRows)); juryPool.Pool.Add(juror); } Console.WriteLine(); Console.WriteLine("Jury Pool:"); Console.WriteLine(); foreach (Juror juror in juryPool.Pool) { Console.WriteLine(juror.firstName + " " + juror.lastName); Console.WriteLine(juror.streetAddress); Console.WriteLine(juror.city + ", " + juror.state + " " + juror.zipcode); Console.WriteLine(); } } else { Console.WriteLine("Please enter a valid whole number"); } Console.ReadLine(); }