public ViewResultBase SearchDebounce(string query) { SearchContractorInput model = new SearchContractorInput(); try { model.CompanyName = _currentUser.CompanyName; model.Query = query; model.Entities = _contractorService.SearchContractor(model); model.Control = "Contractor"; model.Action = "Search"; model.ErrorCode = ErrorCodeHelper.Ok; model.ErrorDescription = ""; } catch (Exception e) { model.ErrorCode = ErrorCodeHelper.Error; model.ErrorDescription = "Error al buscar los Transportistas"; } if (Request.IsAjaxRequest()) { return(PartialView("_contractorListPartial", model)); } return(View("Index", model)); }
public IPagedList <ContractorDto> SearchContractor(SearchContractorInput searchInput) { int currentPageIndex = searchInput.Page.HasValue ? searchInput.Page.Value - 1 : 0; if (searchInput.Query == null) { searchInput.Query = ""; } else { searchInput.Query = searchInput.Query.ToLower(); } var @entities = _contractorRepository.GetAll(); @entities = @entities.Where(c => c.IsDeleted != null && c.CompanyName.Equals(searchInput.CompanyName) && c.IsDeleted.Value == false && (c.CompleteName.ToLower().Contains(searchInput.Query) || c.CompleteName.ToLower().Equals(searchInput.Query))); return(@entities.OrderByDescending(p => p.CompleteName).MapTo <List <ContractorDto> >().ToPagedList(currentPageIndex, searchInput.MaxResultCount)); }
public ActionResult AjaxPage(string query, int?page) { SearchContractorInput model = new SearchContractorInput(); model.Page = page; model.Query = query; try { model.CompanyName = _currentUser.CompanyName; model.Entities = _contractorService.SearchContractor(model); model.ErrorCode = ErrorCodeHelper.Ok; model.ErrorDescription = ""; } catch (Exception) { model.ErrorCode = ErrorCodeHelper.Error; model.ErrorDescription = "Error al buscar los Transportistas"; } return(PartialView("_contractorListPartial", model)); }
public ActionResult Index(int?page) { SearchContractorInput model = new SearchContractorInput(); try { model.Query = ""; model.CompanyName = _currentUser.CompanyName; model.Entities = _contractorService.SearchContractor(model); model.Control = "Contractor"; model.Action = "Search"; model.ErrorCode = ErrorCodeHelper.Ok; model.ErrorDescription = ""; } catch (Exception e) { model.ErrorCode = ErrorCodeHelper.Error; model.ErrorDescription = "Error al buscar los Transportistas"; } return(View(model)); }
public ViewResultBase Search(SearchContractorInput model) { try { model.CompanyName = _currentUser.CompanyName; var entities = _contractorService.SearchContractor(model); model.Entities = entities; model.ErrorCode = ErrorCodeHelper.Ok; model.ErrorDescription = ""; } catch (Exception e) { model.ErrorCode = ErrorCodeHelper.Error; model.ErrorDescription = "Error al buscar los Transportistas"; } if (Request.IsAjaxRequest()) { return(PartialView("_contractorListPartial", model)); } return(View("Index", model)); }