public ListAgencyViewModel Search(string kw, int pageindex, int pagesize) { var specification = new AgencySpecification(kw, kw); var agencies = _IAgencyRepository.ListPaged(specification, "DateModified_desc", pageindex, pagesize); var total = _IAgencyRepository.Count(specification); return(new ListAgencyViewModel() { Agencies = agencies.Select(a => new AgencyViewModel(a)).ToList(), Pager = new PagerViewModel(pageindex, pagesize, total) }); }