public ActionResult _Index1(ProductStyleSearch styleSearch, 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 StyleModelList = Services.ProductStyleService.GetSearchData(styleSearch, page, out 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(StyleModelList)); }
public List <ProductStyleModel> GetSearchData(ProductStyleSearch styleSearch, int?page, out int TotalCount) { int pageNumber = (page ?? 1); var body = JsonConvert.SerializeObject(styleSearch); var result = ServerResponse.Invoke <ServiceResult <List <ProductStyleModel> > >("api/productStyle/getSearchData", body, "Post"); TotalCount = result.TotalCount; if (result.data != null) { var model = result.data.ToList(); return(model); } else { } return(result.data.ToList()); }
public ServiceResult <List <ProductStyle> > GetSearchData(ProductStyleSearch productStyleSearch) { ServiceResult <List <ProductStyle> > model = new ServiceResult <List <ProductStyle> >(); var source = db.ProductStyles.Where(x => x.IsActive == true); if (productStyleSearch != null) { if (!string.IsNullOrEmpty(productStyleSearch.StyleSKU)) { source = source.Where(m => m.StyleSKU == productStyleSearch.StyleSKU); } } var result = source.ToList(); int count = result.Count(); model.TotalCount = count; model.data = result; return(model);; }