public GridViewModel GetSearchResult(SearchRequest request) { var model = PatientMapper.CreateGridViewModel(); var getAllPatient = _repository.GetContext().Patients .Where(p => !p.IsArchived); var pageResult = QueryListHelper.SortResults(getAllPatient, request); var serviceRows = pageResult .Select(PatientMapper.BindGridData); model.Rows = serviceRows.ToPagedList(request.Page ?? 1, request.PageSize); return(model); }
public GridViewModel GetSearchResult(SearchRequest request) { var model = PatientMapper.CreateGridViewModel(); var getAllPatient = _repository.GetContext().Patients .Include(p => p.Gender) .Where(p => !p.IsArchived); var pageResult = QueryListHelper.SortResults(getAllPatient, request); var serviceRows = pageResult .Where(p => string.IsNullOrEmpty(request.SearchText) || p.GetDisplayName().ToLowerInvariant().Contains(request.SearchText.ToLowerInvariant())) .Select(PatientMapper.BindGridData); model.Rows = serviceRows.ToPagedList(request.Page ?? 1, request.PageSize); return(model); }