Exemplo n.º 1
0
 public IEnumerable <Answer> GetByQuestionId(int questionId)
 {
     using (var db = new EntitiesContainer())
     {
         var result = db.Answers_ByQuestionId_Select(questionId).ToList();
         if (result != null)
         {
             return(result.Select(x => new Answer
             {
                 AnsVal = x.ansVal,
                 ExendedDetails = x.ExtendedDetails,
                 Id = x.ID,
                 IdFromOldOT = x.id_FromOldOT,
                 IsImage = x.isImage,
                 ModifyBy = x.modifyBy,
                 ModifyDate = x.modifyDate,
                 Notes = x.Notes,
                 OrdinalPos = x.ordinalPos,
                 QID = x.QID,
                 QuesdtionID_FromOldOT = x.questionID_FromOldOT,
                 Txt = x.txt,
                 Worth = x.worth
             }));
         }
         return(null);
     }
 }
Exemplo n.º 2
0
 public IEnumerable <Question> GetAll()
 {
     using (var db = new EntitiesContainer())
     {
         return(db.Items_Select().ToList()
                .Select(x => new Question
         {
             ApproveDate = x.ApproveDate,
             ApproveUser = x.ApproveUser,
             Complexity = x.Complexity,
             Components = null,
             CourseId = x.courseID,
             CreateDate = x.CreateDate,
             CreateUserId = x.CreateUserID,
             Difficulty = x.Difficulty,
             ExtendedDetails = x.ExtendedDetails,
             GradeLevel = x.GradeLevel,
             Id = x.questionID,
             IdFromOldOT = x.QuestionID_FromOldOT,
             MasterQuestionId = x.masterQuestionID,
             MaxScore = x.maxScore,
             MinScore = x.minScore,
             ModifyDate = x.ModifyDate,
             ModifyUserId = x.ModifyUserID,
             Notes = x.Notes,
             PassageId = x.passageID,
             PassageIdFromOldOT = x.PassageID_FromOldOT,
             QuestionText = x.questionText,
             QuestionTypeId = x.QuestionTypeID,
             StatusId = x.statusID,
             SubjectId = x.SubjectID,
             Targ = x.targ
         }).ToList());
     }
 }
Exemplo n.º 3
0
        public Question Get(int id)
        {
            using (var db = new EntitiesContainer())
            {
                var result = db.Items_ById_Select(id).FirstOrDefault();
                if (result != null)
                {
                    var question = new Question
                    {
                        ApproveDate     = result.ApproveDate,
                        ApproveUser     = result.ApproveUser,
                        Complexity      = result.Complexity,
                        Components      = null,
                        CourseId        = result.courseID,
                        CreateDate      = result.CreateDate,
                        CreateUserId    = result.CreateUserID,
                        Difficulty      = result.Difficulty,
                        ExtendedDetails = result.ExtendedDetails,
                        GradeLevel      = result.GradeLevel,
                        Id                 = result.questionID,
                        IdFromOldOT        = result.QuestionID_FromOldOT,
                        MasterQuestionId   = result.masterQuestionID,
                        MaxScore           = result.maxScore,
                        MinScore           = result.minScore,
                        ModifyDate         = result.ModifyDate,
                        ModifyUserId       = result.ModifyUserID,
                        Notes              = result.Notes,
                        PassageId          = result.passageID,
                        PassageIdFromOldOT = result.PassageID_FromOldOT,
                        QuestionText       = result.questionText,
                        QuestionTypeId     = result.QuestionTypeID,
                        StatusId           = result.statusID,
                        SubjectId          = result.SubjectID,
                        Targ               = result.targ
                    };

                    question.Answers = AnswerRepository.GetByQuestionId(question.Id).ToList();
                    return(question);
                }
            }
            return(null);
        }
Exemplo n.º 4
0
 public ConnectionProvider()
 {
     this.connection = new EntitiesContainer();
 }