public async Task <PaginatedEntityResponseModel <PatientResponse> > GetPatientsAsync(int pageSize, int pageIndex, string orderBy, string order, string search) { IEnumerable <Patient> patientsFromDb = await _patientRepository.GetAsync(pageSize, pageIndex, orderBy, order, search); int totalPatients = await _patientRepository.CountPatients(search); IEnumerable <PatientResponse> patientResponses = patientsFromDb .Select(x => _patientMapper.Map(x)); return(new PaginatedEntityResponseModel <PatientResponse>( pageIndex, pageSize, totalPatients, patientResponses)); }
public int CountPatients(string searchVal) { return(_patientRepository.CountPatients(searchVal)); }