public virtual async Task <ActionResult> ListAjax(QuestionSearchRequest request) { var viewModel = await _questionService.GetPagedListAsync(request); if (viewModel.Questions == null || !viewModel.Questions.Any()) { return(Content("no-more-info")); } return(PartialView(MVC.Question.Views._ListAjax, viewModel)); }
public async Task<QuestionListViewModel> GetPagedListAsync(QuestionSearchRequest request) { var questions = _questions.AsNoTracking().Include(a => a.CreatedBy) .Include(a => a.ModifiedBy).OrderByDescending(a => a.CreatedOn).AsQueryable(); var query = await questions.ProjectTo<QuestionViewModel>(_mappingEngine) .Skip((request.PageIndex - 1) * 10) .Take(10).ToListAsync(); return new QuestionListViewModel { SearchRequest = request, Questions = query }; }
public QuestionSearch(QuestionSearchRequest request) { if (request != null) { CourseId = request.CourseId; QuestionIds = request.QuestionIds; Keyword = request.Keyword; QuestionType = request.QuestionType; Status = request.Status; PageIndex = request.PageIndex; PageSize = request.PageSize; } }
public async Task <QuestionListViewModel> GetPagedListAsync(QuestionSearchRequest request) { var questions = _questions.AsNoTracking().Include(a => a.CreatedBy) .Include(a => a.ModifiedBy).OrderByDescending(a => a.CreatedOn).AsQueryable(); var query = await questions.ProjectTo <QuestionViewModel>(_mappingEngine) .Skip((request.PageIndex - 1) * 10) .Take(10).ToListAsync(); return(new QuestionListViewModel { SearchRequest = request, Questions = query }); }
public IActionResult Search(QuestionSearcherViewModel searcher) { QuestionSearchRequest request = new QuestionSearchRequest { CourseId = searcher.CourseId, Keyword = searcher.Keyword, PageIndex = searcher.PageIndex, PageSize = searcher.PageSize, QuestionIds = searcher.QuestionIds.SplitToLongArray(), QuestionType = searcher.QuestionType, Status = searcher.Status }; var result = service.Search(request); return(Ok(result)); }
public virtual async Task<ActionResult> ListAjax(QuestionSearchRequest request) { var viewModel = await _questionService.GetPagedListAsync(request); if (viewModel.Questions == null || !viewModel.Questions.Any()) return Content("no-more-info"); return PartialView(MVC.Question.Views._ListAjax, viewModel); }
/// <summary> /// 搜索题目信息 /// </summary> /// <param name="request"></param> /// <returns></returns> public PagerModel <Questions> Search(QuestionSearchRequest request) { QuestionSearch search = new QuestionSearch(request); return(search.Search()); }