Пример #1
0
        public void AddPolicies()
        {
            if (!_dbContext.PolicyVersions.Any())
            {
                var policy = new PolicyVersion
                {
                    PolicyId   = 1,
                    PolicyFrom = new DateTime(2019, 1, 1),
                    PolicyTo   = new DateTime(2019, 12, 31),
                    Insureds   = new List <Insured>()
                    {
                        new Insured {
                            InsuredId = 1
                        },
                        new Insured {
                            InsuredId = 2
                        }
                    },
                    CoveredServices = new List <CoveredService>()
                    {
                        new CoveredService
                        {
                            ServiceCode = "KONS_INTERNISTA",
                            CoPayment   = new PercentCoPayment(0.1m),
                            Limit       = new AmountLimit(1000m, new PolicyYearLimitPeriod(), false)
                        },
                        new CoveredService
                        {
                            ServiceCode = "KONS_LARYNGOLOG",
                            CoPayment   = new PercentCoPayment(0.1m),
                            Limit       = new AmountLimit(1200m, new CalendarYearLimitPeriod(), true)
                        },
                        new CoveredService
                        {
                            ServiceCode = "KONS_GASTROLOG",
                            CoPayment   = null,
                            Limit       = new AmountLimit(500m, new PerCaseLimitPeriod(), false)
                        },
                    }
                };

                _dbContext.PolicyVersions.Add(policy);
            }

            _dbContext.SaveChanges();
        }
Пример #2
0
 public void CommitChanges()
 {
     _dbContext.SaveChanges();
 }