public static FullEnrollmentData GetFullEnrollmentData(InsuranceContext _context, int enrollmentID) { /* * SELECT * * FROM [dbo].[Enrollments] e * JOIN [dbo].[Subscribers] s ON e.SubscriberID = s.SubscriberID * JOIN [dbo].[HouseholdMembers] h ON s.SubscriberID = h.SubscriberID */ var enrollments = (from e in _context.Enrollments join s in _context.Subscribers on e.SubscriberID equals s.SubscriberID join h in _context.HouseholdMembers on s.SubscriberID equals h.SubscriberID where e.EnrollmentID == enrollmentID select new FullEnrollmentData { EnrollmentID = e.EnrollmentID, InsurancePlanID = e.InsurancePlanID, PlanYear = e.PlanYear, SubscriberID = e.SubscriberID, ConfirmationCode = e.ConfirmationCode, TimeStamp = e.TimeStamp, FirstName = s.FirstName, MiddleName = s.MiddleName, LastName = s.LastName, AddressLine1 = s.AddressLine1, AddressLine2 = s.AddressLine2, City = s.City, State = s.State, ZipCode = s.ZipCode, County = s.County, EmailAddress = s.EmailAddress, PhoneNumber = s.PhoneNumber, SocialSecurityNumber = s.SocialSecurityNumber, EmploymentIncome = s.EmploymentIncome, InvestmentIncome = s.InvestmentIncome, IsMilitary = s.IsMilitary, IsOnDisability = s.IsOnDisability, IsOnMedicare = s.IsOnMedicare, IsStudent = s.IsStudent, IsUSCitizen = s.IsUSCitizen, AlimonyChildSupport = s.AlimonyChildSupport, HouseholdMemberID = h.HouseholdMemberID, Relationship = h.Relationship, DateOfBirth = h.DateOfBirth, Gender = h.Gender, TobaccoUse = h.TobaccoUse }); return(enrollments.First()); }
public static void EnsureSeedData(this InsuranceContext context) { if (!context.InsurancePlans.Any()) { context.InsurancePlans.AddRange( new InsurancePlan { PlanName = "Catastrophic", Premium = 163.88, IndividualDeductible = 7150.00, FamilyDeductible = 14350, IndividualOutOfPocketMax = 7150, FamilyOutOfPocketMax = 14300, ERVisitAfterDeductible = 0, FreePrimaryCareVisits = 3, PrimaryCareVisitCostAfterDeductible = 0, IsSpecial = false, Level = PlanLevel.Catastrophic }, new InsurancePlan { PlanName = "Bronze", Premium = 229.56, IndividualDeductible = 4500, FamilyDeductible = 9000, IndividualOutOfPocketMax = 7150, FamilyOutOfPocketMax = 14300, ERVisitAfterDeductible = 0, FreePrimaryCareVisits = 0, PrimaryCareVisitCostAfterDeductible = 35, IsSpecial = false, Level = PlanLevel.Bronze }, new InsurancePlan { PlanName = "Silver", Premium = 309.64, IndividualDeductible = 2500, FamilyDeductible = 5000, IndividualOutOfPocketMax = 7150, FamilyOutOfPocketMax = 14300, ERVisitAfterDeductible = 0, FreePrimaryCareVisits = 0, PrimaryCareVisitCostAfterDeductible = 25.00, IsSpecial = false, Level = PlanLevel.Silver }, new InsurancePlan { PlanName = "Gold", Premium = 386.34, IndividualDeductible = 750, FamilyDeductible = 1500, IndividualOutOfPocketMax = 4500, FamilyOutOfPocketMax = 9000, ERVisitAfterDeductible = 0, FreePrimaryCareVisits = 0, PrimaryCareVisitCostAfterDeductible = 15, IsSpecial = true, Level = PlanLevel.Gold }); context.SaveChanges(); } }