示例#1
0
        public async Task <bool> AddQuestion(ExamQuestion question)
        {
            var questionData = new Infrastructure.DataModel.ExamQuestion()
            {
                SourceConversionId      = question.SourceConversionId,
                DestinationConversionId = question.DestinationConversionId,
                ExamId     = question.ExamId,
                InputValue = question.InputValue
            };

            return(await _testRepository.AddQuestion(questionData));
        }
        public async Task <bool> AddQuestion(ExamQuestion question)
        {
            var questionData = new Infrastructure.DataModel.ExamQuestion()
            {
                ExamQuestionId = question.ExamQuestionId,
                Exam           = new Infrastructure.DataModel.Exam()
                {
                    ExamId        = question.ExamId,
                    DateCompleted = question.Exam.DateCompleted,
                    Description   = question.Exam.Description,
                    IsComplete    = false,
                    DateCreated   = question.Exam.DateCreated,
                    IsCreated     = question.Exam.IsCreated,
                    IsGraded      = question.Exam.IsGraded,
                    StudentId     = question.Exam.StudentId,
                    TeacherId     = question.Exam.TeacherId
                },
                DestinationConversion = new Infrastructure.DataModel.Conversion()
                {
                    ConversionId   = question.DestinationConversion.ConversionId,
                    ConversionName = question.DestinationConversion.ConversionName,
                    ConversionType = new Infrastructure.DataModel.ConversionType()
                    {
                        ConversionTypeId = question.DestinationConversion.ConversionTypeId,
                        ConversionName   = question.DestinationConversion.ConversionName
                    },
                    ConversionTypeId = question.DestinationConversion.ConversionTypeId
                },
                SourceConversion = new Infrastructure.DataModel.Conversion()
                {
                    ConversionId   = question.SourceConversion.ConversionId,
                    ConversionName = question.SourceConversion.ConversionName,
                    ConversionType = new Infrastructure.DataModel.ConversionType()
                    {
                        ConversionTypeId = question.SourceConversion.ConversionTypeId,
                        ConversionName   = question.SourceConversion.ConversionName
                    },
                    ConversionTypeId = question.SourceConversion.ConversionTypeId
                },
                ExamQuestionAnswer = new List <Infrastructure.DataModel.ExamQuestionAnswer>(),

                SourceConversionId      = question.SourceConversionId,
                DestinationConversionId = question.DestinationConversionId,
                ExamId     = question.ExamId,
                InputValue = question.InputValue
            };

            return(await _testRepository.AddQuestion(questionData));
        }