예제 #1
0
        public static void Initialize(SpeakerContext context)
        {
            if (!context.Speakers.Any())
            {
                context.Speakers.Add(new Speaker
                {
                    FirstName = "Richard",
                    LastName = "Stone"
                });
                context.Speakers.Add(new Speaker
                {
                    FirstName = "Anthony",
                    LastName = "Lee"
                });
                context.Speakers.Add(new Speaker
                {
                    FirstName = "Tommy",
                    LastName = "Douglas"
                });
                context.Speakers.Add(new Speaker
                {
                    FirstName = "Charles",
                    LastName = "Brown"
                });
                context.Speakers.Add(new Speaker
                {
                    FirstName = "Peter",
                    LastName = "Mason"
                });

                context.SaveChanges();
            }
        }
예제 #2
0
 public SpeakersController(SpeakerContext context)
 {
     _context = context;
 }