public ActionResult GetPageSearch(int?page) { int pageSize = VariableUtils.pageSize; int pageNumber = (page ?? 1); if (Session["KeyWordSearch"] != null) { var name = Session["KeyWordSearch"].ToString(); var listSearch = _producerService.SearchProducerByName(name); var listSearchModel = AutoMapper.Mapper.Map <IEnumerable <ProducerViewModel> >(listSearch); return(PartialView("_PartialViewProducer", listSearchModel.ToPagedList(pageNumber, pageSize))); } return(PartialView("_PartialViewProducer", _listProducerViewModel.ToPagedList(pageNumber, pageSize))); }
public JsonResult GetProducerList(string searchTerm) { var list = _producerService.GetAll(); if (searchTerm != null) { list = _producerService.SearchProducerByName(searchTerm); } var modifiedData = list.Select(t => new { id = t.Id, text = t.NameProducer }); return(Json(modifiedData, JsonRequestBehavior.AllowGet)); }