async Task InitExamPartsAsync(Exam exam, ExamSettingsViewModel examSettingsView, IEnumerable <SubjectQuestionsViewModel> subjectQuestionsList)
        {
            List <int> recruitQuestionIds = new List <int>();

            if (exam.ExamType == ExamType.Recruit)
            {
                //只要歷屆試題
                recruitQuestionIds = _questionsService.FetchAllRecruitQuestionIds().ToList();
            }

            var pickedQids = new List <int>();

            foreach (var examPartSettings in examSettingsView.Parts)
            {
                // 依照設定, 隨機出題
                var examPart = new ExamPart
                {
                    Points       = examPartSettings.Points,
                    MultiAnswers = examPartSettings.MultiAnswers,
                    Order        = examPartSettings.Order,
                    OptionCount  = examPartSettings.OptionCount,
                    Title        = examPartSettings.Title
                };

                var qids = examPartSettings.PickQuestionIds(subjectQuestionsList, pickedQids, recruitQuestionIds);
                pickedQids.AddRange(qids);

                var questions = (await _questionsService.FetchByIdsAsync(qids)).ToList();

                examPart.LoadExamQuestions(questions);

                exam.Parts.Add(examPart);
            }

            //測試是否全為歷屆試題
            if (recruitQuestionIds.HasItems())
            {
                var examQids = exam.QuestionIds;
                var notIn    = examQids.Where(x => !recruitQuestionIds.Contains(x));

                if (notIn.HasItems())
                {
                    throw new ExamNotRecruitQuestionSelected();
                }
            }
        }
        async Task <ExamPart> InitExamPartAsync(RecruitViewModel recruitView)
        {
            var examPart = new ExamPart
            {
                Points       = recruitView.Points,
                MultiAnswers = recruitView.MultiAnswers,
                Order        = recruitView.Order,
                OptionCount  = recruitView.OptionCount,
                Title        = recruitView.Title
            };


            var questions = (await _questionsService.FetchByIdsAsync(recruitView.QuestionIds)).ToList();

            examPart.LoadExamQuestions(questions);

            return(examPart);
        }