public IQueryable <BasItems> GetAllItemsQuery(SearchItemsDto input) { return(_repository.Query() .WhereIf(input.UserID.HasValue, p => p.Id == input.UserID.Value) .WhereIf(!string.IsNullOrWhiteSpace(input.ItemsType), p => p.ItemType.Contains(input.ItemsType)) .Where(x => x.IsDelete == false) ); }
public async Task <IActionResult> GetItemsList(int?page, int?limit, string searchInput) { SearchItemsDto search = string.IsNullOrWhiteSpace(searchInput) ? new SearchItemsDto() : JsonConvert.DeserializeObject <SearchItemsDto>(searchInput); var lst = await _basIemsService.GetAllItemsQuery(search).ToPagedListAsync(page ?? 0, limit ?? int.MaxValue); var result = new ReturnViewModel <BasItems>() { count = lst.Total, data = lst.Items }; return(Json(result)); }