public ActionResult List(string sortBy = "Nombre", string direction = "asc", string filterBy = "All", string searchString = "", int pageSize = 10, int page = 1) { var pageList = VendedorService.GetVendedorByPage(page, pageSize, sortBy, direction, filterBy, searchString); var vendedorsVM = Mapper.Map <IEnumerable <Vendedor>, IEnumerable <VendedorListViewModel> >(pageList.ToList()).ToList(); if (Request.IsAjaxRequest()) { var result = new { PageSize = pageList.PageSize, Pages = pageList.PageCount, CurrentPage = pageList.PageNumber, Total = pageList.TotalItemCount, Records = vendedorsVM }; return(Json(result, JsonRequestBehavior.AllowGet)); } var pageVM = new VendedorPageViewModel(filterBy, sortBy); pageVM.SearchString = searchString; pageVM.List = vendedorsVM; return(View("List", pageVM)); }