public ActionResult _Index1(ProductCategorySearch productCategorySearch, int?page) { int TotalCount = 0; var pageSize = 10; var pageNumber = page ?? 1; int CurrentPage = pageNumber; var endPage = CurrentPage + 4; int PagesToShow = 10; ViewBag.PageSize = pageSize; var ProductCategoryModelList = Services.ProductCategoryService.GetSearchData(productCategorySearch, page, out TotalCount); ViewBag.TotalCount = TotalCount; ViewBag.TotalCount = TotalCount; var result = Helper.CommonFunction.GetPages(TotalCount, pageSize, CurrentPage, PagesToShow); int totalPages = (TotalCount / pageSize) + (TotalCount % pageSize == 0 ? 0 : 1); ViewBag.result = result; ViewBag.totalPages = totalPages; ViewBag.CurrentPage = CurrentPage; var pageCount = result.Count(); ViewBag.pageCount = pageCount; ViewBag.endPage = endPage; return(View(ProductCategoryModelList)); }
public ServiceResult <List <ProductCategory> > GetSearchData(ProductCategorySearch productCategorySearch) { ServiceResult <List <ProductCategory> > model = new ServiceResult <List <ProductCategory> >(); var source = db.ProductCategories.Where(x => x.IsActive == true); var pageSize = 10; var CurrentPage = 1; if (productCategorySearch != null) { if (!string.IsNullOrEmpty(productCategorySearch.Code)) { source = source.Where(m => m.Code == productCategorySearch.Code); } } int count = source.Count(); var items = source.OrderByDescending(x => x.Id).Skip(((productCategorySearch.Page ?? 1) - 1) * pageSize).Take(pageSize).ToList(); model.data = items.Select(x => new ProductCategory { Id = x.Id, Code = x.Code, // Description=x.Description, IsActive = x.IsActive }).ToList(); model.TotalCount = count; return(model);; }
public List <ProductCategoryViewModel> Search(ProductCategorySearch search) { var query = _context.ProductCategories.Select(p => new ProductCategoryViewModel() { Id = p.Id, Name = p.Name, Picture = p.Picture, DateCreate = p.DateCreate.ToPersian(), }); if (!string.IsNullOrWhiteSpace(search.Name)) { query = query.Where(p => p.Name.Contains(search.Name)); } return(query.OrderByDescending(p => p.Id).ToList()); }
public List <ProductCategoryModel> GetSearchData(ProductCategorySearch areaSearch, int?page, out int TotalCount) { int pageNumber = (page ?? 1); var body = JsonConvert.SerializeObject(areaSearch); var result = ServerResponse.Invoke <ServiceResult <List <ProductCategoryModel> > >("api/productCategory/getSearchData", body, "Post"); TotalCount = result.TotalCount; if (result.data != null) { var model = result.data.ToList(); return(model); } else { } return(result.data.ToList()); }
public List <ProductCategoryViewModel> Search(ProductCategorySearch search) { return(ProductCategoryRepository.Search(search)); }
public async Task <IActionResult> OnPostDataAsync(int page, int rows, ProductCategorySearch where) { var data = await _service.GetListAsync(page, rows, where, null); return(PagerData(data.items, page, rows, data.count)); }
public void OnGet(ProductCategorySearch search) { ProductCategories = _productCategoryApplication.Search(search); }