public DataTableResult <CustomUser> SearchPerksUsers(DataTableAjaxPostModel model) { var searchBy = (model.search != null) ? model.search.value : null; var take = model.length; var skip = model.start; string sortBy = ""; bool sortDir = true; if (model.order != null) { // in this example we just default sort on the 1st column sortBy = model.columns[model.order[0].column].data; sortDir = model.order[0].dir.ToLower() == "asc"; } // search the dbase taking into consideration table sorting and paging TittleUserServices _UserServices = new TittleUserServices(); DataTableResult <CustomUser> result = new Models.DataTableResult <CustomUser>(); int filteredResultsCount = 0; int totalResultsCount = 0; int iosCount = 0; int androidCount = 0; string countryGrouping = ""; result.result = _UserServices.GetPerksUsedUsersList(searchBy, take, skip, sortBy, sortDir, out filteredResultsCount, out totalResultsCount, out iosCount, out androidCount, out countryGrouping); result.filteredResultsCount = filteredResultsCount; result.totalResultsCount = totalResultsCount; result.iosCount = iosCount; result.androidCount = androidCount; result.countryGrouping = countryGrouping; if (result.result == null) { // empty collection... return(new DataTableResult <CustomUser>()); } return(result); }