// delete public void DeleteStudent() { List <Student> students = ViewStudents(); if (students.Count != 0) { Student student = _optionSelector.SelectWayOfChoosingStudent(); if (student == null) { Console.WriteLine(Environment.NewLine + "The student data doesn't exist."); } else { List <StudentModule> studentModules = _studentModulePresenter.GetStudentModuleByStudentId(student.StudentId); if (studentModules.Count == 0) { _studentPresenter.DeleteStudent(student.StudentId); Console.WriteLine(Environment.NewLine + "Successfully deleted."); } else { Console.WriteLine("The student still has some modules. Please unaasign the student to all the modules, so you can delete the data."); } } } else { } }
// show which modules student takes by selecting student id public void ViewStudentModuleByStudentId() { List <Student> students = _studentView.ViewStudents(); Console.WriteLine(Environment.NewLine); if (students.Count != 0) { Console.WriteLine("Please type in the student id to check which modules he/she takes."); int studentId = _optionSelector.SelectIntOption(); Student student = _studentPresenter.GetStudentById(studentId); List <StudentModule> studentModules = _studentModulePresenter.GetStudentModuleByStudentId(studentId); if (student != null) { if (studentModules.Count != 0) { bool once = true; foreach (StudentModule studentModule in studentModules) { if (once) { Console.WriteLine("[Student Info]" + Environment.NewLine); _studentView.ShowStudentEachData(studentModule.Student); Console.WriteLine(Environment.NewLine + "[Module Info of the student's]"); once = false; } Console.WriteLine($"Module Id: {studentModule.Module.ModuleId} Module Name: {studentModule.Module.ModuleName}"); } } else { Console.WriteLine("The student doesn't take any module so far."); } } else { Console.WriteLine("Sorry, the student data couldn't be found."); } } else { } }