public ViewResultBase SearchDebounce(string query) { SearchCategoryInput model = new SearchCategoryInput(); try { model.Query = query; model.CompanyName = _currentUser.CompanyName; model.Entities = _categoryService.SearchCategory(model); model.Control = "Category"; model.Action = "Search"; model.ErrorCode = ErrorCodeHelper.Ok; model.ErrorDescription = ""; } catch (Exception e) { model.ErrorCode = ErrorCodeHelper.Error; model.ErrorDescription = "Error al buscar las Ubicaciones"; } if (Request.IsAjaxRequest()) { return(PartialView("_categoryListPartial", model)); } return(View("Index", model)); }
public IPagedList <CategoryDto> SearchCategory(SearchCategoryInput 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 = _categoryRepository.GetAll(); @entities = @entities.Where(c => c.IsDeleted != null && c.IsDeleted.Value == false && c.CompanyName.Equals(searchInput.CompanyName) && (c.Name.ToLower().Contains(searchInput.Query) || c.Name.ToLower().Equals(searchInput.Query))); return(@entities.OrderByDescending(p => p.Name).MapTo <List <CategoryDto> >().ToPagedList(currentPageIndex, searchInput.MaxResultCount)); }
public ActionResult AjaxPage(string query, int?page) { SearchCategoryInput model = new SearchCategoryInput(); model.Page = page; model.Query = query; try { model.CompanyName = _currentUser.CompanyName; model.Entities = _categoryService.SearchCategory(model); model.ErrorCode = ErrorCodeHelper.Ok; model.ErrorDescription = ""; } catch (Exception) { model.ErrorCode = ErrorCodeHelper.Error; model.ErrorDescription = "Error al buscar las Categorías"; } return(PartialView("_categoryListPartial", model)); }
public ActionResult Index(int?page) { SearchCategoryInput model = new SearchCategoryInput(); try { model.Query = ""; model.CompanyName = _currentUser.CompanyName; model.Entities = _categoryService.SearchCategory(model); model.Control = "Category"; model.Action = "Search"; model.ErrorCode = ErrorCodeHelper.Ok; model.ErrorDescription = ""; } catch (Exception e) { model.ErrorCode = ErrorCodeHelper.Error; model.ErrorDescription = "Error al buscar las Categorías"; } return(View(model)); }
public ViewResultBase Search(SearchCategoryInput model) { try { model.CompanyName = _currentUser.CompanyName; var entities = _categoryService.SearchCategory(model); model.Entities = entities; model.ErrorCode = ErrorCodeHelper.Ok; model.ErrorDescription = ""; } catch (Exception e) { model.ErrorCode = ErrorCodeHelper.Error; model.ErrorDescription = "Error al buscar las Categorías"; } if (Request.IsAjaxRequest()) { return(PartialView("_categoryListPartial", model)); } return(View("Index", model)); }