コード例 #1
0
        public static void Initialize(SacramentContext context)
        {
            if (context.SacramentPlan.Any())
            {
                return;
            }

            var plans = new SacramentPlan[]
            {
            };

            foreach (SacramentPlan p in plans)
            {
                context.SacramentPlan.Add(p);
            }
            context.SaveChanges();

            var speakers = new Speaker[]
            {
            };

            foreach (Speaker s in speakers)
            {
                context.Speaker.Add(s);
            }
            context.SaveChanges();
        }
コード例 #2
0
        public static void Initialize(SacramentContext context)
        {
            if (context.SacramentPlan.Any())
            {
                return;
            }

            var plans = new SacramentPlan[]
            {
                new SacramentPlan {
                    Date        = DateTime.Parse("2018-09-12"), Conducting = "Bishop Thayne", OpeningHymn = "The Spirit of God",
                    Invocation  = "Brother Brown", SacramentHymn = "There is a Green Hill Far Away", IntermediateHymn = "Put Your Shoulder to the Wheel",
                    ClosingHymn = "I am a Child of God", Benediction = "Sister Brown"
                },
                new SacramentPlan {
                    Date       = DateTime.Parse("2018-09-19"), Conducting = "Bishop Thayne", OpeningHymn = "Secret Prayer",
                    Invocation = "Brother Orange", SacramentHymn = "I Stand All Amazed", ClosingHymn = "Once there was a Snowman", Benediction = "Sister Orange"
                }
            };

            foreach (SacramentPlan p in plans)
            {
                context.SacramentPlan.Add(p);
            }
            context.SaveChanges();

            var speakers = new Speaker[]
            {
                new Speaker {
                    SacramentPlanID = plans.Single(c => c.Date == DateTime.Parse("2018-09-12")).SacramentPlanID, Name = "Brother Smith", Topic = "Charity"
                },
                new Speaker {
                    SacramentPlanID = plans.Single(c => c.Date == DateTime.Parse("2018-09-12")).SacramentPlanID, Name = "Sister Smith", Topic = "Charity"
                },
                new Speaker {
                    SacramentPlanID = plans.Single(c => c.Date == DateTime.Parse("2018-09-19")).SacramentPlanID, Name = "Sister Blue", Topic = "Faith"
                },
                new Speaker {
                    SacramentPlanID = plans.Single(c => c.Date == DateTime.Parse("2018-09-19")).SacramentPlanID, Name = "Brother Jones", Topic = "Baptism"
                }
            };

            foreach (Speaker s in speakers)
            {
                context.Speaker.Add(s);
            }
            context.SaveChanges();
        }
コード例 #3
0
        public static void Initialize(SacramentContext context)
        {
            context.Database.EnsureCreated();

            // Look for any students.
            if (context.Meetings.Any())
            {
                return;   // DB has been seeded
            }

            var meetings = new Meeting[]
            {
                new Meeting {
                    MeetingDate = DateTime.Parse("2005-09-01"), ConductingLeader = "Mathew Bahling", OpeningSong = "301 I am a Child of God", SacramentSong = "172 In Humility, Our Savior", ClosingSong = "2 Spirit of God", IntermediateSong = "", OpeningPrayer = "Bekah Howe", ClosingPrayer = "Kent Roper"
                }
            };

            foreach (Meeting m in meetings)
            {
                context.Meetings.Add(m);
            }
            context.SaveChanges();

            var speakers = new Speaker[]
            {
                new Speaker {
                    MeetingID = 1, SpeakerName = "Bro Blazzard", Subject = ".Net and the Gospel"
                }
            };

            foreach (Speaker s in speakers)
            {
                context.Speakers.Add(s);
            }
            context.SaveChanges();
        }
コード例 #4
0
        public static void Initialize(SacramentContext context)
        {
            //check for programs
            if (context.Programs.Any())
            {
                return;
            }

            var programs = new MeetingProgram[]
            {
                new MeetingProgram {
                    programDate = DateTime.Parse("2016-09-01"), Conduct = "Br. Worthington", Preside = "Bishop Christensen", Sacrament = true
                }
            };

            foreach (MeetingProgram m in programs)
            {
                context.Programs.Add(m);
            }
            context.SaveChanges();

            var hymns = new Hymn[]
            {
                new Hymn {
                    MeetingProgramID = 1, hymnNumber = 20, name = "Come, Come Ye Saints", location = HymnLocation.Opening
                },
                new Hymn {
                    MeetingProgramID = 1, hymnNumber = 175, name = "O God, The Eternal Father", location = HymnLocation.Sacrament
                },
                new Hymn {
                    MeetingProgramID = 1, hymnNumber = 81, name = "Press Forward, Saints", location = HymnLocation.Intermediate
                },
                new Hymn {
                    MeetingProgramID = 1, hymnNumber = 2, name = "The Spirit of God", location = HymnLocation.Closing
                }
            };

            foreach (Hymn h in hymns)
            {
                context.Hymns.Add(h);
            }
            context.SaveChanges();

            var talks = new Talk[]
            {
                new Talk {
                    MeetingProgramID = 1, speaker = "Gordon Smith", topic = "Baptism", Reading = "Mosiah 18:8-10", order = 1
                },
                new Talk {
                    MeetingProgramID = 1, speaker = "Jennifer Smith", topic = "The Gift of the Holy Ghost", Reading = "Moroni 10:3-5", order = 2
                },
                new Talk {
                    MeetingProgramID = 1, speaker = "Doug Smith", topic = "Endure to the End", Reading = "2 Nephi 31:19-21", order = 3
                }
            };

            foreach (Talk t in talks)
            {
                context.Talks.Add(t);
            }
            context.SaveChanges();

            var prayers = new Prayer[]
            {
                new Prayer {
                    MeetingProgramID = 1, speaker = "Celeste Smith", location = PrayerLocation.Invocation
                },
                new Prayer {
                    MeetingProgramID = 1, speaker = "Vernon Smith", location = PrayerLocation.Benediction
                }
            };

            foreach (Prayer p in prayers)
            {
                context.Prayers.Add(p);
            }
            context.SaveChanges();
        }