コード例 #1
0
        public IQueryable <ModelStudentAnswer> GetStudentAnswersByStudentByTest(string username, int testid)
        {
            var                       model         = new ModelStudentAnswer();
            StoreQuestion             questionStore = new StoreQuestion(_ctx);
            List <ModelQuestion>      questions     = questionStore.GetQuestionsByTest(testid).ToList();
            List <ModelStudentAnswer> modelQuestion = model.Get(_ctx).Where(x => x.Username == username).ToList();
            List <ModelStudentAnswer> final         = new List <ModelStudentAnswer>();

            modelQuestion.ForEach(cur =>
            {
                ModelQuestion qq = questionStore.GetQuestion(cur.QuestionID);
                foreach (ModelQuestion curQQ in questions)
                {
                    if (curQQ.QuestionID == cur.QuestionID)
                    {
                        final.Add(cur);
                    }
                }
            });
            return(final.AsQueryable());
        }
コード例 #2
0
        public IQueryable <ModelStudentAnswer> GetStudentAnswersByTest(int testid)
        {
            //TODO: needs testing
            var           model                  = new ModelStudentAnswer();
            StoreQuestion questionStore          = new StoreQuestion(_ctx);
            IQueryable <ModelQuestion> questions = questionStore.GetQuestionsByTest(testid);
            List <ModelStudentAnswer>  final     = new List <ModelStudentAnswer>();

            model.Get(_ctx).ToList().ForEach(cur =>
            {
                ModelQuestion qq = questionStore.GetQuestion(cur.QuestionID);
                foreach (ModelQuestion curQQ in questions)
                {
                    if (curQQ.QuestionID == cur.QuestionID)
                    {
                        final.Add(cur);
                    }
                }
            });
            return(final.AsQueryable());
        }