Ejemplo n.º 1
0
        private decimal GetPrice(InsuranceOffer offer, PlanTypes planType, BillingPeriods period)
        {
            var plan = offer.Plans.Single(p => p.PlanType == planType);

            switch (period)
            {
            case BillingPeriods.Monthly:
                return(plan.PriceMonthly);

            case BillingPeriods.Yearly:
                return(Math.Round(12 * plan.PriceMonthly * (decimal.One - offer.YearlyDiscountRate / 100)));

            default:
                throw new ArgumentOutOfRangeException(nameof(period), period, null);
            }
        }
Ejemplo n.º 2
0
 public static PlantType GetPlantType(string name)
 {
     return(PlanTypes.FirstOrDefault(i => i.Name == name));
 }