Example #1
0
        public IList <Empresa> CustomSearchFunc(DataTableAjaxPostModel model, out int filteredResultsCount, out int totalResultsCount)
        {
            var searchBy = (model.search != null) ? model.search.value : null;

            var take = model.length;
            var skip = model.start;

            string sortBy  = "";
            bool   sortDir = false;

            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
            var result = EmpresaService.GetDataList(searchBy, take, skip, sortBy, sortDir, out filteredResultsCount, out totalResultsCount);

            if (result == null)
            {
                // empty collection...
                return(new List <Empresa>());
            }

            return(result);
        }