public ApiClientModel Get(String id) { ClientModel client = _clientManager.Find <ClientModel>(e => e.ID.Equals(id)); CommonToApiModelMapper mapper = new CommonToApiModelMapper(); return(mapper.MapClientCommonModel(client)); }
public ApiInsuranceModel Get(String insuranceId) { /* ApiInsuranceModel insurance = new ApiInsuranceModel * { * //ID = (int)ID, * //AgentID = 1, * //ClientID = 1, * //Joining_Date = new DateTime(2000, 02, 29), * //End_Date = new DateTime(2017, 02, 29), * //Total_Value = 1000000, * }; * * return insurance;*/ InsuranceModel selectedInsurance = _insuranceManager.Find <InsuranceModel>(e => e.ID.Equals(insuranceId)); ClientModel clientModel = _insuranceManager.Find <ClientModel>(e => e.ID.Equals(selectedInsurance.ID)); DocumentModel document = _insuranceManager.Find <DocumentModel>(e => e.InsuranceID.Equals(selectedInsurance.ID)); PolicyCoverageDetailModel pcd = _insuranceManager.Find <PolicyCoverageDetailModel>(e => e.InsuranceID.Equals(selectedInsurance.ID)); CoverageModel coverage = _insuranceManager.Find <CoverageModel>(e => e.ID.Equals(pcd.CoverageID)); CommonToApiModelMapper mapper = new CommonToApiModelMapper(); ApiInsuranceModel mapped = new ApiInsuranceModel(); if (selectedInsurance.InsuranceType.Equals(InsuranceModel.InsuranceTypes.LIFE_INSURANCE)) { LifeInsuranceModel life = _insuranceManager.Find <LifeInsuranceModel>(e => e.ClientID.Equals(selectedInsurance.ClientID)); ApiLifeInsuranceModel apiLifeInsuranceModel = mapper.MapLifeInsuranceCommonModel(life); mapped.SelectedInsurance = apiLifeInsuranceModel; } ApiClientModel apiCLient = mapper.MapClientCommonModel(clientModel); ApiDocumentModel apiDoc = mapper.MapDocumentCommonModel(document); ApiPolicyCoverageDetailModel apiPcd = mapper.MapPolicyCoverageDetailCommonModel(pcd); ApiCoverageModel apiCoverage = mapper.MapCoverageCommonModel(coverage); mapped.Client = apiCLient; mapped.Coverage = apiCoverage; mapped.Documents = apiDoc; mapped.PolicyDetails = apiPcd; return(mapped); }