예제 #1
0
 public virtual async Task<ActionResult> ListAjax(InterviewSearchRequest request)
 {
    
     var viewModel = await _interviewService.GetPagedListAsync(request);
     if (viewModel.Interviews == null || !viewModel.Interviews.Any()) return Content("no-more-info");
     return PartialView(MVC.Interview.Views._ListAjax, viewModel);
 }
예제 #2
0
        public virtual async Task<ActionResult> ListAjax(InterviewSearchRequest request)
        {
            if (!_referentialTeacherService.CanManageTeacher(request.TeacherId)) return HttpNotFound();

            var viewModel = await _interviewService.GetPagedListAsync(request);
            if (viewModel.Interviews == null || !viewModel.Interviews.Any()) return Content("no-more-info");
            return PartialView(MVC.Interview.Views._ListAjax, viewModel);
        }
예제 #3
0
        public async Task<InterviewListViewModel> GetPagedListAsync(InterviewSearchRequest request)
        {
            var interviews = _interviews.Where(a => a.ApplicantId == request.ApplicantId)
                .Include(a => a.CreatedBy).Include(a => a.ModifiedBy).AsNoTracking()
                .OrderByDescending(a => a.InterviewDate).AsQueryable();

            var selectedInterviews = interviews.ProjectTo<InterviewViewModel>(_mappingEngine);

            var query = await selectedInterviews
                .Skip((request.PageIndex - 1) * 10)
                .Take(10)
                .ToListAsync();

            return new InterviewListViewModel { SearchRequest = request, Interviews = query };
        }
예제 #4
0
        public async Task<InterviewListViewModel> GetPagedListAsync(InterviewSearchRequest request)
        {
            var interviews = _interviews.Where(a => a.TeacherId == request.TeacherId).Include(a => a.Interviewer)
                .Include(a => a.Creator).Include(a => a.LasModifier).AsNoTracking()
                .OrderByDescending(a => a.InterviewDate).AsQueryable();

            if (request.Term.HasValue())
                interviews = interviews.Where(a => a.Body.Contains(request.Term) || a.Brief.Contains(request.Term));

            var selectedInterviews = interviews.ProjectTo<InterviewViewModel>(_mappingEngine);

            var query = await selectedInterviews
                .Skip((request.PageIndex - 1) * 10)
                .Take(10)
                .ToListAsync();

            return new InterviewListViewModel { SearchRequest = request, Interviews = query };
        }