public virtual async Task<ActionResult> ListAjax(AddressSearchRequest request) { if (!_referentialTeacherService.CanManageTeacher(request.TeacherId)) return HttpNotFound(); var viewModel = await _addressService.GetAddressesAsync(request); if (viewModel.Addresses == null || !viewModel.Addresses.Any()) return Content("no-more-info"); return PartialView(MVC.Address.Views._ListAjax, viewModel); }
public async Task<AddressListViewModel> GetAddressesAsync(AddressSearchRequest request) { return new AddressListViewModel { Addresses = await _addresses.AsNoTracking() .Where(a => a.ApplicantId == request.ApplicantId) .ProjectTo<AddressViewModel>(_mappingEngine) .OrderByDescending(a => a.CreatedOn) .Skip((request.PageIndex - 1)*5) .Take(5) .ToListAsync(), Request = request }; }
public virtual async Task<ActionResult> ListAjax(AddressSearchRequest request) { var viewModel = await _addressService.GetAddressesAsync(request); if (viewModel.Addresses == null || !viewModel.Addresses.Any()) return Content("no-more-info"); return PartialView(MVC.Address.Views._ListAjax, viewModel); }