public ActionResult Index(string code) { ViewBag.SysModuleCode = code; ProductCategoryAdvanceSearchViewModel productCategoryAvanceSearchVM = new ProductCategoryAdvanceSearchViewModel(); return(View(productCategoryAvanceSearchVM)); }
public JsonResult GetAllProductCategory(DataTableAjaxPostModel model, ProductCategoryAdvanceSearchViewModel productCategoryAdvanceSearchVM) { productCategoryAdvanceSearchVM.DataTablePaging.Start = model.start; productCategoryAdvanceSearchVM.DataTablePaging.Length = (productCategoryAdvanceSearchVM.DataTablePaging.Length == 0) ? model.length : productCategoryAdvanceSearchVM.DataTablePaging.Length; List <ProductCategoryViewModel> productCategoryVMList = Mapper.Map <List <ProductCategory>, List <ProductCategoryViewModel> >(_productCategoryBusiness.GetAllProductCategory(Mapper.Map <ProductCategoryAdvanceSearchViewModel, ProductCategoryAdvanceSearch>(productCategoryAdvanceSearchVM))); if (productCategoryAdvanceSearchVM.DataTablePaging.Length == -1) { int totalResult = productCategoryVMList.Count != 0 ? productCategoryVMList[0].TotalCount : 0; int filteredResult = productCategoryVMList.Count != 0 ? productCategoryVMList[0].FilteredCount : 0; productCategoryVMList = productCategoryVMList.Skip(0).Take(filteredResult > 10000 ? 10000 : filteredResult).ToList(); } return(Json(new { // this is what datatables wants sending back draw = model.draw, recordsTotal = productCategoryVMList.Count != 0 ? productCategoryVMList[0].TotalCount : 0, recordsFiltered = productCategoryVMList.Count != 0 ? productCategoryVMList[0].FilteredCount : 0, data = productCategoryVMList })); }