コード例 #1
0
ファイル: TestEditController.cs プロジェクト: dKluev/Site
        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
ファイル: TestRunController.cs プロジェクト: dKluev/Site
        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
ファイル: TestRunController.cs プロジェクト: dKluev/Site
 private IQueryable <TestQuestion> GetQuestions(List <int> testIds)
 {
     TestQuestionService.LoadWith(x => x.TestAnswers);
     return(TestQuestionService.GetAll(
                x => testIds.Contains(x.TestId)));
 }