public ActionResult Index(string code) { ViewBag.SysModuleCode = code; DistrictAdvanceSearchViewModel districtAdvanceSearchVM = new DistrictAdvanceSearchViewModel(); return(View()); }
public JsonResult GetAllDistrict(DataTableAjaxPostModel model, DistrictAdvanceSearchViewModel districtAdvanceSearchVM) { districtAdvanceSearchVM.DataTablePaging.Start = model.start; districtAdvanceSearchVM.DataTablePaging.Length = (districtAdvanceSearchVM.DataTablePaging.Length == 0) ? model.length : districtAdvanceSearchVM.DataTablePaging.Length; List <DistrictViewModel> districtVMList = Mapper.Map <List <District>, List <DistrictViewModel> >(_districtBusiness.GetAllDistrict(Mapper.Map <DistrictAdvanceSearchViewModel, DistrictAdvanceSearch>(districtAdvanceSearchVM))); if (districtAdvanceSearchVM.DataTablePaging.Length == -1) { int totalResult = districtVMList.Count != 0 ? districtVMList[0].TotalCount : 0; int filteredResult = districtVMList.Count != 0 ? districtVMList[0].FilteredCount : 0; districtVMList = districtVMList.Skip(0).Take(filteredResult > 10000 ? 10000 : filteredResult).ToList(); } return(Json(new { // this is what datatables wants sending back draw = model.draw, recordsTotal = districtVMList.Count != 0 ? districtVMList[0].TotalCount : 0, recordsFiltered = districtVMList.Count != 0 ? districtVMList[0].FilteredCount : 0, data = districtVMList })); }