/// <summary> /// To the domain list object. /// </summary> /// <param name="lowerPayment">The lower payment.</param> /// <returns></returns> public static IList <LowerPayment> ToDomainListObject(this LowerPaymentContract lowerPayment) { var toReturn = lowerPayment == null ? null : new List <LowerPayment>(); if (toReturn != null) { toReturn.Add(lowerPayment.ToDomainObject()); toReturn.Add(lowerPayment.ToDomainObject()); toReturn.Add(lowerPayment.ToDomainObject()); } return(toReturn); }
/// <summary> /// To the domain object. /// </summary> /// <param name="lowerPayment">The lower payment.</param> /// <returns></returns> public static LowerPayment ToDomainObject(this LowerPaymentContract lowerPayment) { return(null == lowerPayment ? new LowerPayment() : new LowerPayment() { UserId = lowerPayment.LessonUserId, FinancialDependents = lowerPayment.IncomeBasedRepayment != null?lowerPayment.IncomeBasedRepayment.FinancialDependents:0, IncomeBasedYearlyIncome = lowerPayment.IncomeBasedRepayment != null ? lowerPayment.IncomeBasedRepayment.AnnualIncome : 0, IncomeSensitiveIncomePercentage = lowerPayment.IncomeSensitiveRepayment != null ? lowerPayment.IncomeSensitiveRepayment.IncomePercentage : 0, IncomeSensitiveYearlyIncome = lowerPayment.IncomeSensitiveRepayment != null ? lowerPayment.IncomeSensitiveRepayment.AnnualIncome : 0 }); }
/// <summary> /// To the data contract. /// </summary> /// <param name="lowerPayments">The lower payments.</param> /// <returns></returns> public static LowerPaymentContract ToDataContract(this IList <LowerPayment> lowerPayments) { if (null == lowerPayments) { return(null); } var toReturn = new LowerPaymentContract(); foreach (var option in lowerPayments) { toReturn.ExtendedRepayment = option.PlanType == RepaymentOptionTypes.ExtendedRepayment ? new ExtendedRepaymentContract() { ExtensionYears = option.ExtendedLength } : null; toReturn.IncomeBasedRepayment = option.PlanType == RepaymentOptionTypes.IncomeBased ? new IncomeBasedRepaymentContract() { AnnualIncome = option.IncomeBasedYearlyIncome, FinancialDependents = option.FinancialDependents } : null; toReturn.IncomeSensitiveRepayment = option.PlanType == RepaymentOptionTypes.IncomeSensitive ? new IncomeSensitiveRepaymentContract() { AnnualIncome = option.IncomeSensitiveYearlyIncome, IncomePercentage = option.IncomeSensitiveIncomePercentage } : null; } return(toReturn); }