public static void Initialize(MeetingContext context)
        {
            context.Database.EnsureCreated();

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

            var Meetings = new Meeting[]
            {
                new Meeting
                {
                    MeetingDate = Convert.ToDateTime("2019-12-01"), Conductor = "Max Alonso", OpeningHymn = "2 - The Spirit of God", SacramentHymn = "193 - I Stand All Amazed",
                    ClosingHymn = "5 - High on the Mountain Top", OpeningPrayer = "Li Yan", ClosingPrayer = "Laura Norman"
                },
                new Meeting
                {
                    MeetingDate = Convert.ToDateTime("2019-12-08"), Conductor = "Max Alonso", OpeningHymn = "27 - Praise to the Man", SacramentHymn = "184 - Upon the Cross of Calvary",
                    ClosingHymn = "3 - Now Let Us Rejoice", OpeningPrayer = "Nino Olivetto", ClosingPrayer = "Peggy Justice"
                }
            };

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

            var Speakers = new Speaker[]
            {
                new Speaker {
                    SpeakerName = "Joseph Smith", MeetingID = 1, Topic = "Atonement"
                },
                new Speaker {
                    SpeakerName = "Russell Nelson", MeetingID = 1, Topic = "Repentance"
                },
                new Speaker {
                    SpeakerName = "David Bednar", MeetingID = 2, Topic = "Faith"
                },
                new Speaker {
                    SpeakerName = "Jeffrey Holland", MeetingID = 2, Topic = "Baptism"
                },
            };

            foreach (Speaker s in Speakers)
            {
                context.Speakers.Add(s);
            }
            context.SaveChanges();
        }
        public static void Initialize(MeetingContext context)
        {
            context.Database.EnsureCreated();

            // Look for any members.
            if (context.sacramentMeetingPlans.Any())
            {
                return;   // DB has been seeded
            }
            // var member = new Member[]
            //{
            // new Member{FirstName="Carson",LastName="Alexander",TalkDate=DateTime.Parse("2005-09-01")},
            // new Member{FirstName="Meredith",LastName="Alonso",TalkDate=DateTime.Parse("2002-09-01")},
            // new Member{FirstName="Arturo",LastName="Anand",TalkDate=DateTime.Parse("2003-09-01")},
            // new Member{FirstName="Gytis",LastName="Barzdukas",TalkDate=DateTime.Parse("2002-09-01")},
            // new Member{FirstName="Yan",LastName="Li",TalkDate=DateTime.Parse("2002-09-01")},

            //};
            // foreach (Member s in member)
            // {
            //     context.Members.Add(s);
            // }
            // context.SaveChanges();
            var sacramentMeetingPlan = new SacramentMeetingPlan[]
            {
                new SacramentMeetingPlan {
                    Date          = DateTime.Parse("2018-04-08"), OpeningPrayer = "Wally Herrera", ClosingPrayer = "Johnny Bingham",
                    OpeningHymn   = "Stand All Amazed", SacramentHymn = "Keep the commandments", ClosingHymn = "Praise to the Man", LeaderName = "Bishop Sells", Presiding = "President Robinson", Topic = "Priesthood Prevlidges",
                    Announcements = "Baby Blessing", Talk1 = "Glad Smith", Talk2 = "Lyndsey Henderson", Talk3 = "Tank Henderson"
                }
            };

            foreach (SacramentMeetingPlan s in sacramentMeetingPlan)
            {
                context.sacramentMeetingPlans.Add(s);
            }
            context.SaveChanges();
        }
        public static void Initialize(MeetingContext context)
        {
            // context.Database.EnsureCreated();

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

            var bishopricMembers = new Bishopric[]
            {
                new Bishopric {
                    BishopricName = "Bishop Coates", Active = true
                },
                new Bishopric {
                    BishopricName = "Brother McInnes", Active = true
                },
                new Bishopric {
                    BishopricName = "Brother Tucker", Active = true
                }
            };

            foreach (Bishopric b in bishopricMembers)
            {
                context.Bishopric.Add(b);
            }
            context.SaveChanges();

            var planners = new Planner[]
            {
                //new Student{FirstMidName="Carson",LastName="Alexander",EnrollmentDate=DateTime.Parse("2005-09-01")},
                //new Student{FirstMidName="Meredith",LastName="Alonso",EnrollmentDate=DateTime.Parse("2002-09-01")},
                //new Student{FirstMidName="Arturo",LastName="Anand",EnrollmentDate=DateTime.Parse("2003-09-01")},
                //new Student{FirstMidName="Gytis",LastName="Barzdukas",EnrollmentDate=DateTime.Parse("2002-09-01")},
                //new Student{FirstMidName="Yan",LastName="Li",EnrollmentDate=DateTime.Parse("2002-09-01")},
                //new Student{FirstMidName="Peggy",LastName="Justice",EnrollmentDate=DateTime.Parse("2001-09-01")},
                //new Student{FirstMidName="Laura",LastName="Norman",EnrollmentDate=DateTime.Parse("2003-09-01")},
                //new Student{FirstMidName="Nino",LastName="Olivetto",EnrollmentDate=DateTime.Parse("2005-09-01")}
                new Planner {
                    MeetingDate = DateTime.Parse("2018-12-09"), BishopricId = 1, OpenPrayer = "Kayla Roberts", ClosePrayer = "Cory Hellbusch"
                },
                new Planner {
                    MeetingDate = DateTime.Parse("2018-12-16"), BishopricId = 2, OpenPrayer = "Dana Roberts", ClosePrayer = "Jordan Fielding"
                }
            };

            foreach (Planner p in planners)
            {
                context.Planner.Add(p);
            }
            context.SaveChanges();

            var speakers = new Speaker[]
            {
                //new Course{CourseID=1050,Title="Chemistry",Credits=3},
                //new Course{CourseID=4022,Title="Microeconomics",Credits=3},
                //new Course{CourseID=4041,Title="Macroeconomics",Credits=3},
                //new Course{CourseID=1045,Title="Calculus",Credits=4},
                //new Course{CourseID=3141,Title="Trigonometry",Credits=4},
                //new Course{CourseID=2021,Title="Composition",Credits=3},
                //new Course{CourseID=2042,Title="Literature",Credits=4}
                new Speaker {
                    PlannerId = 1, SpeakerName = "Alexa Morris", SpeakerTopic = "Charity"
                },
                new Speaker {
                    PlannerId = 1, SpeakerName = "Rachel Johnson", SpeakerTopic = "Charity and Service"
                },
                new Speaker {
                    PlannerId = 1, SpeakerName = "Raquel Gray", SpeakerTopic = "Service"
                },
                new Speaker {
                    PlannerId = 2, SpeakerName = "Bekah Russell", SpeakerTopic = "Love"
                },
                new Speaker {
                    PlannerId = 2, SpeakerName = "Kelly", SpeakerTopic = "Obedience"
                }
            };

            foreach (Speaker s in speakers)
            {
                context.Speakers.Add(s);
            }
            context.SaveChanges();

            var songs = new Song[]
            {
                //new Enrollment{StudentID=1,CourseID=1050,Grade=Grade.A},
                //new Enrollment{StudentID=1,CourseID=4022,Grade=Grade.C},
                //new Enrollment{StudentID=1,CourseID=4041,Grade=Grade.B},
                //new Enrollment{StudentID=2,CourseID=1045,Grade=Grade.B},
                //new Enrollment{StudentID=2,CourseID=3141,Grade=Grade.F},
                //new Enrollment{StudentID=2,CourseID=2021,Grade=Grade.F},
                //new Enrollment{StudentID=3,CourseID=1050},
                //new Enrollment{StudentID=4,CourseID=1050},
                //new Enrollment{StudentID=4,CourseID=4022,Grade=Grade.F},
                //new Enrollment{StudentID=5,CourseID=4041,Grade=Grade.C},
                //new Enrollment{StudentID=6,CourseID=1045},
                //new Enrollment{StudentID=7,CourseID=3141,Grade=Grade.A},
                new Song {
                    PlannerId = 1, OpenSongNum = 6, OpenSongTitle = "Redeemer", SacramentSongNum = 196, SacramentSongTitle = "Jesus", CloseSongNum = 2, CloseSongTitle = "Spirit"
                },
                new Song {
                    PlannerId = 2, OpenSongNum = 239, OpenSongTitle = "Choose", SacramentSongNum = 196, SacramentSongTitle = "Jesus", CloseSongNum = 240, CloseSongTitle = "Know"
                }
            };

            foreach (Song s in songs)
            {
                context.Songs.Add(s);
            }
            context.SaveChanges();
        }
        public static void Initialize(MeetingContext context)
        {
            context.Database.EnsureCreated();

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

            var speakers = new Speaker[]
            {
                new Speaker {
                    Name = "Alexander Laureta"
                },
                new Speaker {
                    Name = "Norman Mota"
                },
                new Speaker {
                    Name = "Olivetto Rivera"
                },
            };

            foreach (Speaker s in speakers)
            {
                context.Speakers.Add(s);
            }
            context.SaveChanges();

            var meetings = new Meeting[]
            {
                new Meeting {
                    MeetingDate = DateTime.Parse("2005-09-01"), Conductor = "Philip Kim", OpeningHymn = "The Spirit of God", Invocation = "Leo Cristiano", SacramentHymn = "As Now We Take The Sacrament", ClosingHymn = "Because I Have Been Given Much", Benediction = "Meredith Laurence", Notes = ""
                },
                new Meeting {
                    MeetingDate = DateTime.Parse("2005-09-08"), Conductor = "Yong Lopez", OpeningHymn = "Come Come Ye Saints", Invocation = "Billy Jones", SacramentHymn = "God, Our Father, Hear Us Pray", ClosingHymn = "I am a Child of God", Benediction = "Robert Frias", Notes = ""
                },
            };

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

            var speakingAssignments = new SpeakingAssignment[]
            {
                new SpeakingAssignment {
                    MeetingID = 1, SpeakerID = 1, Topic = "Faith"
                },
                new SpeakingAssignment {
                    MeetingID = 2, SpeakerID = 2, Topic = "Sacrifice"
                },
                new SpeakingAssignment {
                    MeetingID = 1, SpeakerID = 3, Topic = "Faith"
                },
            };

            foreach (SpeakingAssignment e in speakingAssignments)
            {
                context.SpeakingAssignments.Add(e);
            }
            context.SaveChanges();


            StreamReader   sr         = new StreamReader("../Data/hymns.json");
            string         jsonString = sr.ReadToEnd();
            List <MyModel> myModels   = JsonConvert.DeserializeObject <List <MyModel> >(jsonString);

            /*            var myModels = new MyModel[]
             *          {
             *          new MyModel{name = "The Morning Breaks" },
             *          new MyModel{ name = "The Spirit of God" },
             *          };*/

            foreach (MyModel e in myModels)
            {
                new MyModel {
                    name = e.name
                };
                context.MyModel.Add(e);
            }
            context.SaveChanges();
        }
示例#5
0
        public static void Initialize(MeetingContext context)
        {
            context.Database.EnsureCreated();

            //Check Meetings are empty.

            if (context.Meetings.Any())
            {
                return;
            }

            var meetings = new Meeting[]
            {
                new Meeting {
                    Date            = DateTime.Parse("2020-12-20"),
                    Conducting      = "Bishop Miller",
                    OpeningHymn     = "High on a mountain Top",
                    Invocation      = "Collin Blake",
                    SacramentHymn   = "With Humble Heart",
                    SacramentPrayer = "John Michaels",
                    ClosingHymn     = "Press Forward, Saints",
                    Benediction     = "Charlie Smith"
                },
                new Meeting {
                    Date            = DateTime.Parse("2020-12-27"),
                    Conducting      = "Bishop Miller",
                    OpeningHymn     = "Put Your Shoulder to the Wheel",
                    Invocation      = "Joellen Knuth",
                    SacramentHymn   = "As Now We Take the Sacrament",
                    SacramentPrayer = "Ron Knuth",
                    ClosingHymn     = "God Be with You Till We Meet Again",
                    Benediction     = "John Smith"
                }
            };

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

            context.SaveChanges();

            var speakers = new Speaker[]
            {
                new Speaker {
                    Name = "Amber Crockett", Topic = "Forgiveness", MeetingID = meetings.Single(m => m.Benediction == "Charlie Smith").ID
                },
                new Speaker {
                    Name = "Kaladin Blake", Topic = "Temples", MeetingID = meetings.Single(m => m.Benediction == "Charlie Smith").ID
                },
                new Speaker {
                    Name = "Ronin Blake", Topic = "Faith", MeetingID = meetings.Single(m => m.Benediction == "John Smith").ID
                },
                new Speaker {
                    Name = "Johnathan Blake", Topic = "Repentance", MeetingID = meetings.Single(m => m.Benediction == "John Smith").ID
                }
            };

            foreach (Speaker s in speakers)
            {
                context.Speakers.Add(s);
            }

            context.SaveChanges();

            //var speakerEnrollment = new SpeakerEnrollment[] {
            //    new SpeakerEnrollment { MeetingID = meetings.Single(m => m.Benediction == "Charlie Smith").ID , SpeakerID = speakers.Single(s => s.Name == "Amber Crockett").ID},
            //    new SpeakerEnrollment { MeetingID = meetings.Single(m => m.Benediction == "Charlie Smith").ID , SpeakerID = speakers.Single(s => s.Name == "Kaladin Blake").ID},
            //    new SpeakerEnrollment { MeetingID = meetings.Single(m => m.Benediction == "John Smith").ID , SpeakerID = speakers.Single(s => s.Name == "Ronin Blake").ID},
            //    new SpeakerEnrollment { MeetingID = meetings.Single(m => m.Benediction == "John Smith").ID , SpeakerID = speakers.Single(s => s.Name == "Johnathan Blake").ID}
            //};

            //foreach (SpeakerEnrollment se in speakerEnrollment)
            //{
            //    context.SpeakerEnrollments.Add(se);
            //}

            //context.SaveChanges();
        }