public IActionResult AjaxHandlerTest(DataTableParamViewModel model) { try { // var TableIn = DataTablesIn.ParseJSONString(myDataTableParameter); var requestFormData = Request.Form; List <Models.Item> lstItems = GetData(); var listItems = ProcessCollection(lstItems, requestFormData); // Custom response to bind information in client side dynamic response = new { Data = listItems, Draw = requestFormData["draw"], RecordsFiltered = lstItems.Count, RecordsTotal = lstItems.Count }; return(Json(response)); } catch (Exception e) { return(ThrowJSONError(e)); } }
public IActionResult IndexAjax(DataTableParamViewModel param) { var requestFormData = Request.Form; var search = param.search.value; var total = _staffRepository.Count(search); var listItems = _staffRepository.All(search, param.length, param.start); return(Json(new { Data = listItems, Draw = requestFormData["draw"], RecordsFiltered = total, RecordsTotal = total })); }
public IActionResult ListTablePrivsAjax(DataTableParamViewModel param) { var requestFormData = Request.Form; var search = param.search.value; var searchCondition = !string.IsNullOrWhiteSpace(search) ? $@"WHERE GRANTEE LIKE '%{search}%' OR OWNER LIKE '%{search}%' OR TABLE_NAME LIKE '%{search}%' OR GRANTOR LIKE '%{search}%' OR PRIVILEGE LIKE '%{search}%' " : string.Empty; using (var ole = new OracleConnection(config.GetConnectionString("DefaultConnection"))) { var total = ole.Query <int>($@" select COUNT(*) from sys.DBA_TAB_PRIVS {searchCondition}").FirstOrDefault(); var listItems = ole.Query <TabPrivsModel>($@" select b.* from (select a.*, ROWNUM rnum from ( select * from sys.DBA_TAB_PRIVS {searchCondition} ) a where ROWNUM <= {(param.start + param.length)}) b where b.rnum > {param.start}"); return(Json(new { Data = listItems, Draw = requestFormData["draw"], RecordsFiltered = total, RecordsTotal = total })); } }