コード例 #1
0
ファイル: TestService.cs プロジェクト: astorDev/Oge_math
        public static List <ResultDTO> CheckSubmission(List <SubmissionDTO> submissions)
        {
            var result = new List <ResultDTO>();

            foreach (var answer in submissions)
            {
                int    id            = answer.Id;
                double studentAnswer = answer.StudentAnswer.Value;
                double rightAnswer   = QuestionsRepository.GetAnswerForQuestion(id);
                bool   correctness   = studentAnswer == rightAnswer;
                string text          = QuestionsRepository.GetTextForQuestion(id);

                result.Add(new ResultDTO
                {
                    Id            = id,
                    Text          = text,
                    StudentAnswer = studentAnswer,
                    RightAnswer   = rightAnswer,
                    Correctness   = correctness
                });
            }

            return(result);
        }
コード例 #2
0
 public static string GetTextForQuestion(int id)
 {
     return(QuestionsRepository.GetTextForQuestion(id));
 }