private static void ShowStudents() { //Instantiate the Student Data Mapper class StudentDataMapper student_mapper = new StudentDataMapper(); var students = student_mapper.Select(); //List<Student> students = student_mapper.Select(); var output = new StringBuilder(); output.AppendLine("Student ID\tFirst Name\tLast Name\tEnroll Date\tMajor"); output.AppendLine("-----------\t----------\t----------\t-----------\t---------"); //Loop throuth students list and display values foreach (var stu in students) { output.Append(stu.ID.ToString().PadRight(10)); output.Append("\t"); output.Append(stu.FirstName.PadRight(10)); output.Append("\t"); output.Append(stu.LastName.PadRight(10)); output.Append("\t"); output.Append(string.Format("{0:d}", stu.EnrollDate).PadRight(10)); output.Append("\t"); output.Append(stu.Major.PadRight(10)); output.AppendLine(); } Console.WriteLine(output.ToString()); }
private static void ShowStudents() { //instantiate the student data mapper class StudentDataMapper student_mapper = new StudentDataMapper(); // var students = student_mapper.Select(); List <Student> students = student_mapper.Select(); var output = new StringBuilder(); output.AppendLine("Student ID\tFirst Name\tLast Name\tEnroll Date\tMajor"); output.AppendLine("---------\t---------\t---------\t---------\t---------"); foreach (var stu in students) { output.AppendLine(stu.ID.ToString().PadRight(10)); output.Append("\t"); output.Append } }