public static void Initialize(SacramentMeetingPlannerContext context) { if (context.MeetingPlan.Any()) { return; } var planArrays = new MeetingPlan[] { new MeetingPlan { MeetingDate = DateTime.Parse("2020-12-20"), ConductingLeader = "Brother Matthew Bachelor", OpeningHymnNumber = 26, OpeningHymnTitle = "Oh! How Lovely was the Morning", OpeningPrayer = "Mary Coker", SacramentHymnNumber = 196, SacramentHymnTitle = "Jesus Once of Humble Birth", IntermediateHymnNumber = 70, IntermediateHymnTitle = "Sing Praise to Him", ClosingHymnNumber = 166, ClosingHymnTitle = "Abide with Me", ClosingPrayer = "Martin Oakley" }, new MeetingPlan { MeetingDate = DateTime.Parse("2020-12-27"), ConductingLeader = "Bishop Samuel Ammon", OpeningHymnNumber = 201, OpeningHymnTitle = "Joy to the World", OpeningPrayer = "Michael Anthony", SacramentHymnNumber = 193, SacramentHymnTitle = "I Stand All Amaze", IntermediateHymnNumber = 202, IntermediateHymnTitle = "Oh, Come all ye Faithful", ClosingHymnNumber = 204, ClosingHymnTitle = "Silent Night", ClosingPrayer = "Angela Morrison" } }; foreach (MeetingPlan planner in planArrays) { context.MeetingPlan.Add(planner); } context.SaveChanges(); var speakerArrays = new MeetingSpeaker[] { new MeetingSpeaker { MeetingPlanID = planArrays.Single(c => c.MeetingDate == DateTime.Parse("2020-12-20")).MeetingPlanID, MeetingSpeakerName = "Akins Smith", MeetingSpeakerTopic = "Joseph Smith: The Prophet of the Restoration" }, new MeetingSpeaker { MeetingPlanID = planArrays.Single(c => c.MeetingDate == DateTime.Parse("2020-12-20")).MeetingPlanID, MeetingSpeakerName = "Jayden Sabbath", MeetingSpeakerTopic = "The Living Prophets Today" }, new MeetingSpeaker { MeetingPlanID = planArrays.Single(c => c.MeetingDate == DateTime.Parse("2020-12-20")).MeetingPlanID, MeetingSpeakerName = "Maxwell Allstar", MeetingSpeakerTopic = "We Listen to a Prophet Voice" }, new MeetingSpeaker { MeetingPlanID = planArrays.Single(c => c.MeetingDate == DateTime.Parse("2020-12-27")).MeetingPlanID, MeetingSpeakerName = "Jeremiah Ussher", MeetingSpeakerTopic = "The Birth of Jesus Christ" }, new MeetingSpeaker { MeetingPlanID = planArrays.Single(c => c.MeetingDate == DateTime.Parse("2020-12-27")).MeetingPlanID, MeetingSpeakerName = "Dora Cobblah", MeetingSpeakerTopic = "The Life of Jesus Christ" }, new MeetingSpeaker { MeetingPlanID = planArrays.Single(c => c.MeetingDate == DateTime.Parse("2020-12-27")).MeetingPlanID, MeetingSpeakerName = "Alexander Aikins", MeetingSpeakerTopic = "The Atonement of Jesus Christ" } }; foreach (MeetingSpeaker speaker in speakerArrays) { context.MeetingSpeaker.Add(speaker); } context.SaveChanges(); }
public static void Initialize(SacramentMeetingPlannerContext context, RoleManager <IdentityRole> roleManager, UserManager <IdentityUser> userManager) { context.Database.EnsureCreated(); // Create default roles if not existing if (roleManager.FindByNameAsync("Administrator").Result == null) { IdentityRole role = new IdentityRole { Name = "Administrator" }; roleManager.CreateAsync(role).Wait(); } if (roleManager.FindByNameAsync("Bishopric").Result == null) { IdentityRole role = new IdentityRole { Name = "Bishopric" }; roleManager.CreateAsync(role).Wait(); } // Create default user if not existing // Add default user to default role if existing if (userManager.FindByEmailAsync("*****@*****.**").Result == null) { IdentityUser user = new IdentityUser { UserName = "******", Email = "*****@*****.**" }; IdentityResult result = userManager.CreateAsync(user, "5am33P1an!").Result; if (result.Succeeded) { if (!userManager.IsInRoleAsync(user, "Administrator").Result) { userManager.AddToRoleAsync(user, "Administrator").Wait(); } if (!userManager.IsInRoleAsync(user, "Bishopric").Result) { userManager.AddToRoleAsync(user, "Bishopric").Wait(); } } } if (context.Meetings.Any()) { return; // DB has been seeded } // Seed other data var meetings = new Meeting[] { new Meeting { MeetingDate = DateTime.Parse("2019-03-29"), Conducting = "Bishop Regie Mesina", Invocation = "Brother Drazen Lucic", OpeningSong = "#21, \"Come Listen to a Prophet's Voice\"", SacramentSong = "#184, \"Upon the Cross of Calvary\"", IntermediateSong = "Choir, \"We'll Bring The World His Truth/As Sister's in Zion\"", ClosingSong = "#19, \"We Thank Thee o Good for a Prophet\"", Benediction = "Sister Anna Liza Alzona" }, new Meeting { MeetingDate = DateTime.Parse("2019-04-05"), Conducting = "Brother Roy Javier", Invocation = "Sister Cheryl Lucic", OpeningSong = "#2, \"The Spirit of God\"", SacramentSong = "#183, \"In Remembrance of Thy Suffering\"", IntermediateSong = "Choir, \"We'll Bring The World His Truth/As Sister's in Zion\"", ClosingSong = "#92, \"For the Beauty of the Earth\"", Benediction = "Brother Anthony Lawrence Gampon" }, }; foreach (Meeting m in meetings) { context.Meetings.Add(m); } context.SaveChanges(); var settings = new Setting[] { new Setting { Name = "Unit Name", Value = "Dubai 1st Ward (Tagalog)" }, new Setting { Name = "Timing", Value = "3PM - 4PM" }, new Setting { Name = "Presiding", Value = "Bishop Reggie Mesina" }, }; foreach (Setting s in settings) { context.Settings.Add(s); } context.SaveChanges(); var speakers = new Speaker[] { new Speaker { MeetingID = 1, SpeakerName = "Brother Lance Aaron Mesina", Subject = "Follow the Prophet", Block = Block.FIRST, Order = 1 }, new Speaker { MeetingID = 1, SpeakerName = "Brother Wayne Brockbank", Subject = "Ministering", Block = Block.SECOND, Order = 1 }, new Speaker { MeetingID = 2, SpeakerName = "Brother Czamuel Alzona", Subject = "Importance of Daily Scipture Study", Block = Block.FIRST, Order = 1 }, new Speaker { MeetingID = 2, SpeakerName = "Sister Natalia Cruz Lopez", Subject = "Eternal Family", Block = Block.FIRST, Order = 2 }, new Speaker { MeetingID = 2, SpeakerName = "Brother Rafael Semblante", Subject = "Self Reliance", Block = Block.SECOND, Order = 1 } }; foreach (Speaker s in speakers) { context.Speakers.Add(s); } context.SaveChanges(); }