コード例 #1
0
        // GET: Questions
        public async Task <ActionResult> Index(string courseId, string levelId, string contentId, string keyword = "", string orderBy = "", string isAscending = "")
        {
            ControllerHelper c = new ControllerHelper(courseId, levelId, contentId, keyword, orderBy, isAscending);

            c.SetViewBagValues(ViewBag);
            var dbSet        = db.Questions;
            var queryable    = dbSet.ByCourse(c.CourseId).ByLevel(c.LevelId).ByContent(c.ContentId);
            var requestModel = new QuestionRequestModel(keyword, orderBy, isAscending);
            var list         = await requestModel.GetOrderedData(queryable).Include(x => x.Content).ToListAsync();

            return(View(list));
        }
コード例 #2
0
        // GET: Questions
        public async Task <ActionResult> Index(string courseId, string levelId, string contentId, string keyword = "", string orderBy = "", string isAscending = "")
        {
            ControllerHelper c = new ControllerHelper(courseId, levelId, contentId, keyword, orderBy, isAscending);

            ViewBag.CourseId    = c.CoursesSelectList;
            ViewBag.LevelId     = c.LevelsSelectList;
            ViewBag.ContentId   = c.ContentsSelectList;
            ViewBag.OrderBy     = c.OrderBySelectList;
            ViewBag.IsAscending = c.IsAscendingSelectList;
            ViewBag.Keyword     = keyword;
            var queryable    = db.Questions.ByCourse(c.CourseId).ByLevel(c.LevelId).ByContent(c.ContentId);
            var requestModel = new QuestionRequestModel(keyword, orderBy, isAscending);
            var list         = await requestModel.GetOrderedData(queryable).Include(x => x.Content).ToListAsync();

            return(View(list));
        }