public virtual async Task<ActionResult> ListAjax(EducationalBackgroundSearchRequest request) { var viewModel = await _educationalBackgroundService.GetPagedListAsync(request); if (viewModel.EducationalBackgrounds == null || !viewModel.EducationalBackgrounds.Any()) return Content("no-more-info"); return PartialView(MVC.EducationalBackground.Views._ListAjax, viewModel); }
public virtual async Task<ActionResult> ListAjax(EducationalBackgroundSearchRequest request) { if (!_referentialTeacherService.CanManageTeacher(request.TeacherId)) return HttpNotFound(); var viewModel = await _educationalBackgroundService.GetPagedListAsync(request); if (viewModel.EducationalBackgrounds == null || !viewModel.EducationalBackgrounds.Any()) return Content("no-more-info"); return PartialView(MVC.EducationalBackground.Views._ListAjax, viewModel); }
public async Task<EducationalBackgroundListViewModel> GetPagedListAsync(EducationalBackgroundSearchRequest request) { var educationalBackgrounds = _educationalBackgrounds.Where(a => a.ApplicantId == request.ApplicantId) .Include(a => a.CreatedBy) .Include(a => a.ModifiedBy) .AsNoTracking() .OrderByDescending(a => a.CreatedOn) .AsQueryable(); var selectedEducationalBackgrounds = educationalBackgrounds.ProjectTo<EducationalBackgroundViewModel>(_mappingEngine); var resultToSkip = (request.PageIndex - 1)*10; var query = await selectedEducationalBackgrounds .Skip(()=>resultToSkip) .Take(10).ToListAsync(); return new EducationalBackgroundListViewModel { SearchRequest = request, EducationalBackgrounds = query }; }
public async Task<EducationalBackgroundListViewModel> GetPagedListAsync(EducationalBackgroundSearchRequest request) { var educationalBackgrounds = _educationalBackgrounds.Where(a => a.TeacherId == request.TeacherId) .Include(a => a.Creator) .Include(a => a.LasModifier) .Include(a => a.StudyField) .Include(a => a.Institution) .AsNoTracking() .OrderByDescending(a => a.GraduationDate) .AsQueryable(); var selectedEducationalBackgrounds = educationalBackgrounds.ProjectTo<EducationalBackgroundViewModel>(_mappingEngine); var query = await selectedEducationalBackgrounds .Skip((request.PageIndex - 1)*10) .Take(10).ToListAsync(); return new EducationalBackgroundListViewModel { SearchRequest = request, EducationalBackgrounds = query }; }