Ejemplo n.º 1
0
 /// <summary>
 /// Method to get insurance from database based on user query.
 /// </summary>
 /// <param name="insuranceQuery">insuranceQuery contains query parameters to get insurances.</param>
 /// <returns>ResponseModel containing list of InsuranceDto.</returns>
 public ResponseModel Get(InsuranceQuery insuranceQuery)
 {
     using (var unitOfWork = new UnitOfWork())
     {
         //Creating a parameter less query model if it is null from request
         if (insuranceQuery == null)
         {
             insuranceQuery = new InsuranceQuery(id: CommonString.OptionalStringParamInteger, name: CommonString.OptionalStringParam, phoneNumber: CommonString.OptionalStringParam, pubId: CommonString.OptionalStringParam);
         }
         insuranceQuery.SetTypedVariables();
         var result = unitOfWork.Insurances.FindAll(QueryExpressions.Insurance(insuranceQuery));
         result = result.OrderByDescending(m => m.Id).ToList();
         return(ReturnStatements.SuccessResponse(CollectionConversions.ListInsurance(result)));
     }
 }
 /// <summary>
 /// Method to get patient insurance from database based on user query.
 /// </summary>
 /// <param name="patientInsuranceQuery">patientInsuranceQuery containing query to get PatientInsuranceDto from database</param>
 /// <returns>ResponseModel containing list of PatientInsuranceDto</returns>
 public ResponseModel Get(PatientInsuranceQuery patientInsuranceQuery)
 {
     using (var unitOfWork = new UnitOfWork())
     {
         //Creating a parameter less query model if it is null from request
         if (patientInsuranceQuery == null)
         {
             patientInsuranceQuery = new PatientInsuranceQuery(patientId: CommonString.OptionalStringParamInteger, insuranceId: CommonString.OptionalStringParamInteger);
         }
         patientInsuranceQuery.SetTypedVariables();
         var result = unitOfWork.PatientInsurances.FindOnConstraint(QueryExpressions.PatientInsurance(patientInsuranceQuery), prop => prop.Insurance, prop => prop.Patient).ToList();
         result = result.OrderByDescending(m => m.Id).ToList();
         return(ReturnStatements.SuccessResponse(CollectionConversions.ListPatientInsuranceToDto(ConvertPatientInsuranceToPairList(result))));
     }
 }