示例#1
0
        /// <summary>
        /// To the data contract.
        /// </summary>
        /// <param name="fasterRepayments">The faster repayments.</param>
        /// <returns></returns>
        public static FasterRepaymentContract ToDataContract(this IList <FasterRepayment> fasterRepayments)
        {
            if (null == fasterRepayments)
            {
                return(null);
            }

            var toReturn = new FasterRepaymentContract();

            foreach (var option in fasterRepayments)
            {
                toReturn.AdditionalMonthlyPayment =
                    option.PlanType == RepaymentOptionTypes.PayMoreEachMonth
                       ? new AdditionalPaymentContract()
                {
                    MonthlyPayment = option.AdditionalMonthlyPayment
                }
                       : null;
                toReturn.BetterInterestRate =
                    option.PlanType == RepaymentOptionTypes.BetterInterestRate
                       ? new BetterInterestRateContract()
                {
                    LowerInterestRate = option.LowerInterestRate
                }
                       : null;
                toReturn.LoanPaymentTimeline =
                    option.PlanType == RepaymentOptionTypes.SetYourOwnTimeline
                       ? new CustomTimelineContract()
                {
                    Timeline = option.ShorterTimeline
                }
                       : null;
            }
            return(toReturn);
        }
示例#2
0
 /// <summary>
 /// To the domain object.
 /// </summary>
 /// <param name="fasterRepayment">The faster repayment.</param>
 /// <returns></returns>
 public static FasterRepayment ToDomainObject(this FasterRepaymentContract fasterRepayment)
 {
     return(null == fasterRepayment
                ? null
                : new FasterRepayment()
     {
         UserId = fasterRepayment.LessonUserId,
         LowerInterestRate = fasterRepayment.BetterInterestRate != null?fasterRepayment.BetterInterestRate.LowerInterestRate:0,
         AdditionalMonthlyPayment = fasterRepayment.AdditionalMonthlyPayment != null?fasterRepayment.AdditionalMonthlyPayment.MonthlyPayment:0,
         ShorterTimeline = fasterRepayment.LoanPaymentTimeline != null? fasterRepayment.LoanPaymentTimeline.Timeline:0
     });
 }
示例#3
0
        /// <summary>
        /// To the domain list object.
        /// </summary>
        /// <param name="fasterRepayment">The faster repayment.</param>
        /// <returns></returns>
        public static IList <FasterRepayment> ToDomainListObject(this FasterRepaymentContract fasterRepayment)
        {
            var toReturn = fasterRepayment == null ? null : new List <FasterRepayment>();

            if (toReturn != null)
            {
                toReturn.Add(fasterRepayment.ToDomainObject());
                toReturn.Add(fasterRepayment.ToDomainObject());
                toReturn.Add(fasterRepayment.ToDomainObject());
            }

            return(toReturn);
        }