public Task <IPaginatedList <MedicalRecordDto> > GetAll(MedicalRecordFilter filter) { Expression <Func <TMedicalRecord, bool> > medicalRecordExpression = null; Expression <Func <TPatient, bool> > patientExpression = null; if (!string.IsNullOrEmpty(filter.Code)) { medicalRecordExpression = c => c.Code.Contains(filter.Code); } else if (!string.IsNullOrEmpty(filter.PatientCode)) { patientExpression = c => c.Code.Contains(filter.Code); } else if (!string.IsNullOrEmpty(filter.PatientName)) { patientExpression = c => (c.FirstName + " " + c.LastName).Contains(filter.PatientName); } else if (!string.IsNullOrEmpty(filter.IdentifyCardNo)) { patientExpression = c => c.IdentifyCardNo.Contains(filter.IdentifyCardNo); } else { medicalRecordExpression = c => c.IsActived; } return(GetAll(medicalRecordExpression, patientExpression, filter.PageIndex, filter.PageSize)); }
public Task <IPaginatedList <MedicalRecordDto> > Get(string code, string value, int pageIndex = Constant.PAGE_INDEX_DEFAULT, int pageSize = Constant.PAGE_SIZE_DEFAULT) { var filter = new MedicalRecordFilter { PageIndex = pageIndex, PageSize = pageSize, Code = string.Equals("Code", code, StringComparison.OrdinalIgnoreCase) ? value : string.Empty, PatientCode = string.Equals("PatientCode", code, StringComparison.OrdinalIgnoreCase) ? value : string.Empty, PatientName = string.Equals("PatientName", code, StringComparison.OrdinalIgnoreCase) ? value : string.Empty, IdentifyCardNo = string.Equals("IdentifyCardNo", code, StringComparison.OrdinalIgnoreCase) ? value : string.Empty, }; return(_medicalRecordBusiness.GetAll(filter)); }