public void Run() { bool inMenu = true; int command; while (inMenu) { PrintSpaces(); Console.Write(GetMenu()); try { command = Int32.Parse(Console.ReadLine()); } catch (Exception e) { continue; } switch (command) { case 1: Console.Write("Student id: "); String id = Console.ReadLine(); foreach (Student s in service.FilterStudentById(id)) { Console.WriteLine(s.GetId() + " " + s.Name); } pressEnterToContinue(); break; case 2: Console.Write("Student group: "); int group = Int32.Parse(Console.ReadLine()); foreach (Student s in service.FilterStudentByGroup(group)) { Console.WriteLine(s.GetId() + " " + s.Name); } pressEnterToContinue(); break; case 3: Console.Write("Homework id: "); int hid = Int32.Parse(Console.ReadLine()); foreach (Homework h in service.FilterHomeworkById(hid)) { Console.WriteLine(h.Description + " Target week: " + h.TargetWeek); } pressEnterToContinue(); break; case 4: Console.Write("Student id: "); id = Console.ReadLine(); foreach (Grade g in service.FilterGradesByStudentId(id)) { Console.WriteLine("Homework: " + g.HomeworkId + " Grade: " + g.GradeValue); } pressEnterToContinue(); break; case 5: Console.Write("Homework id: "); hid = Int32.Parse(Console.ReadLine()); foreach (Grade g in service.FilterGradesByHomeworkId(hid)) { Console.WriteLine("Student: " + g.StudentId + " Grade: " + g.GradeValue); } pressEnterToContinue(); break; case 0: inMenu = false; break; } } }