public virtual async Task<ActionResult> ListAjax(EntireEvaluationSearchRequest request) { if (!_referentialTeacherService.CanManageTeacher(request.TeacherId)) return HttpNotFound(); var viewModel = await _entireEvaluationService.GetPagedListAsync(request); if (viewModel.EntireEvaluations == null || !viewModel.EntireEvaluations.Any()) return Content("no-more-info"); return PartialView(MVC.EntireEvaluation.Views._ListAjax, viewModel); }
public async Task<EntireEvaluationListViewModel> GetPagedListAsync(EntireEvaluationSearchRequest request) { var entireEvaluations = _entireEvaluations.Where(a=>a.ApplicantId==request.ApplicantId) .Include(a => a.CreatedBy).Include(a => a.ModifiedBy).AsNoTracking() .OrderByDescending(a => a.EvaluationDate).AsQueryable(); var selectedEntireEvaluations = entireEvaluations.ProjectTo<EntireEvaluationViewModel>(_mappingEngine); var query =await selectedEntireEvaluations .Skip((request.PageIndex - 1)*10) .Take(10).ToListAsync(); return new EntireEvaluationListViewModel { SearchRequest = request, EntireEvaluations = query }; }
public virtual async Task<ActionResult> ListAjax(EntireEvaluationSearchRequest request) { var viewModel = await _entireEvaluationService.GetPagedListAsync(request); if (viewModel.EntireEvaluations == null || !viewModel.EntireEvaluations.Any()) return Content("no-more-info"); return PartialView(MVC.EntireEvaluation.Views._ListAjax, viewModel); }