Пример #1
0
        public ActionResult GetQuestions(int testId, AjaxGridRequest model)
        {
            var list = TestQuestionService.GetAll(x => x.TestId == testId)
                       .Select(x => new { x.Id, x.Description }).ToPagedList(model.Page - 1, model.Rows);

            list = list.Select(x => new { x.Id, Description = StringUtils.ReplaceGLT(x.Description) })
                   .ToPagedList(list);

            return(Json(new GridData(list.PageCount,
                                     model.Page,
                                     list.Count,
                                     list), JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult UserTestAnswers(int userTestId)
        {
            UserTestService.LoadWith(x => x.Test);
            var userTest = UserTestService.GetByPK(userTestId);

            if (!userTest.ShowAnswers ||
                userTest.UserId != User.UserID)
            {
                return(null);
            }
            var qIds = UserTestAnswerService.GetAll(x => x.UserTestId == userTestId && !x.IsRight)
                       .Select(x => x.QuestionId).ToList();

            TestQuestionService.LoadWith(x => x.TestAnswers);
            var model = new UserTestAnswerVM {
                Questions = TestQuestionService.GetAll(x => qIds.Contains(x.Id)).ToList(),
                UserTest  = userTest
            };

            return(BaseViewWithModel(new UserTestAnswersView(), model));
        }
Пример #3
0
 private IQueryable <TestQuestion> GetQuestions(List <int> testIds)
 {
     TestQuestionService.LoadWith(x => x.TestAnswers);
     return(TestQuestionService.GetAll(
                x => testIds.Contains(x.TestId)));
 }