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); } }
public static PlantType GetPlantType(string name) { return(PlanTypes.FirstOrDefault(i => i.Name == name)); }