/// <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))));
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Generic query expression for PatientInsurance service
 /// </summary>
 /// <param name="patientInsuranceQuery">patientInsuranceQuery having query on patient insurance</param>
 /// <returns>Func delegate to return to the Entity framework of type PatientInsurance,bool</returns>
 public static Func <PatientInsurance, bool> PatientInsurance(PatientInsuranceQuery patientInsuranceQuery)
 {
     return(new Func <PatientInsurance, bool>(m => (!patientInsuranceQuery.PatientId.Equals(CommonInteger.OptionalIntegerParam) ? m.PatientId.Equals(patientInsuranceQuery.PatientId) : true) &&
                                              (!patientInsuranceQuery.InsuranceId.Equals(CommonInteger.OptionalIntegerParam) ? m.InsuranceId.Equals(patientInsuranceQuery.InsuranceId) : true)));
 }
Exemplo n.º 3
0
        public HttpResponseMessage Get([FromUri] PatientInsuranceQuery patientInsuranceQuery)
        {
            var result = _services.Get(patientInsuranceQuery);

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }