public void DisplayModulePage()
        {
            Console.WriteLine("########## You can select your action below. ##########" + Environment.NewLine);
            Console.WriteLine("Register new module data                                 : 1 {0}" +
                              "Show all the modules data                                : 2 {0}" +
                              "Edit the specified module data                           : 3 {0}" +
                              "Delete the specified module data                         : 4 {0}" +
                              "Go back to the previous page                             : 0 {0}", Environment.NewLine);

            string selected = _optionSelector.SelectStringOption();

            switch (selected)
            {
            case "1":
                _moduleView.RegisterModule();
                break;

            case "2":
                _moduleView.ViewModules();
                break;

            case "3":
                _moduleView.EditModule();
                break;

            case "4":
                _moduleView.DeleteModule();
                break;

            case "0":
                break;
            }

            _optionSelector.PressKey();
        }
Beispiel #2
0
        // show which students are assigned to the module by selecting module id
        public void ViewStudentModuleByModuleId()
        {
            List <Module> modules = _moduleView.ViewModules();

            Console.WriteLine(Environment.NewLine);

            if (modules.Count != 0)
            {
                Console.WriteLine("Please type in the module id to check which students are assigned to the module.");
                int    moduleId = _optionSelector.SelectIntOption();
                Module module   = _modulePresenter.GetModuleById(moduleId);
                List <StudentModule> studentModules = _studentModulePresenter.GetStudentModuleByModuleId(moduleId);
                if (module != null)
                {
                    if (studentModules.Count != 0)
                    {
                        bool once = true;
                        foreach (StudentModule studentModule in studentModules)
                        {
                            if (once)
                            {
                                Console.WriteLine("[Module Info]" + Environment.NewLine);
                                Console.WriteLine($"Module Id: {studentModule.Module.ModuleId}  Module Name: {studentModule.Module.ModuleName}");
                                Console.WriteLine(Environment.NewLine + "[Student Info of the module]");
                                once = false;
                            }

                            _studentView.ShowStudentEachData(studentModule.Student);
                        }
                    }
                    else
                    {
                        Console.WriteLine("The module is not assigned to any students so far.");
                    }
                }
                else
                {
                    Console.WriteLine("Sorry, the module data couldn't be found.");
                }
            }
            else
            {
            }
        }