public static void ShowTrainersInCourse()
        {
            Console.Clear();
            CourseDb            cDb     = new CourseDb();
            TrainersPerCourseDb tpcDb   = new TrainersPerCourseDb();
            List <Course>       courses = cDb.GetCourses();

            if (courses.Count != 0)
            {
                Console.WriteLine("Please select a course by using its number on the list: \n");
                ShowList(courses, "Courses");

                bool result = Int32.TryParse(Console.ReadLine(), out int courseID);
                while (!result || (courseID < 1 || courseID > courses.Count))
                {
                    Console.Write($"Wrong input! Please select using numbers from 1 to {courses.Count} ");
                    result = Int32.TryParse(Console.ReadLine(), out courseID);
                }
                Console.Clear();

                List <Trainer> trainersPerCourse = tpcDb.GetTrainersPerCourse(courseID);
                ShowList(trainersPerCourse, $"Trainers Per This Course");
            }
            else
            {
                Console.WriteLine("There are no trainers or courses yet");
            }
        }
예제 #2
0
        public static void CoursesMenu()
        {
            Console.WriteLine("  1. All Courses\n  2. Students per course\n  3. Assignments per Course\n  4. Trainers per Course\n  5. Create a new Course\n  6. Go back");
            bool result = Int32.TryParse(Console.ReadLine(), out int choice);

            while (!result || (choice < 1 && choice > 6))
            {
                Console.Write("Wrong input! Please select from number 1 to 6\n");
                result = Int32.TryParse(Console.ReadLine(), out choice);
            }
            Console.Clear();

            switch (choice)
            {
            case 1:
                List <Course> courses = cDB.GetCourses();
                ShowLists.ShowList(courses, "Courses");
                break;

            case 2:
                ShowLists.ShowStudentsInCourse();
                break;

            case 3:
                ShowLists.ShowAssignmentsInCourse();
                break;

            case 4:
                ShowLists.ShowTrainersInCourse();
                break;

            case 5:
                CourseManager.CreateCourse();
                break;
            }
        }