public FilteredResultModel <List <ApplicationType> > GetFilteredApplicationTypes(string searchText, string filterType, string sortColumn, FCSortDirection sortDirection, int?start = null, int?length = null) { Expression <Func <ApplicationType, bool> > deleg = null; if (!string.IsNullOrEmpty(searchText)) { string rawPhoneNumber = searchText.Replace("-", "", StringComparison.InvariantCultureIgnoreCase); searchText = searchText.ToLower(); // deleg = x => x.ApplicationTypeId.ToLower().Contains(searchText); } IEnumerable <ApplicationType> query; //Implement OrderBy or OrderByDesc string defaultOrderBy = "ApplicationTypeName"; if (!string.IsNullOrEmpty(sortColumn) && sortColumn.ToLower() != "ApplicationTypeId") { query = _applicationTypeRepository.FindWithInclude(deleg, sortColumn, sortDirection, null, start, length); } else { query = _applicationTypeRepository.FindWithInclude(deleg, defaultOrderBy, null, null, start, length); } return(new FilteredResultModel <List <ApplicationType> > { Data = query.ToList(), TotalDataCount = _applicationTypeRepository.Count(), FilteredDataCount = _applicationTypeRepository.Count(deleg) }); }