예제 #1
0
 public static void Initialize(IServiceProvider serviceProvider)
 {
     using (var context = new ScripturesJournalContext(serviceProvider.GetRequiredService <DbContextOptions <ScripturesJournalContext> >()))
     {
         // Look for any scriptures
         if (context.Scripture.Any())
         {
             return; // DB has been seeded
         }
         context.Scripture.AddRange(
             new Scripture
         {
             Book             = "Alma",
             RegistrationDate = DateTime.Parse("2018-1-11"),
             Chapter          = 42,
             Verse            = 12,
             Notes            = "Powerful   verse!"
         },
             new Scripture
         {
             Book             = "Helaman",
             RegistrationDate = DateTime.Parse("2018-2-11"),
             Chapter          = 5,
             Verse            = 12,
             Notes            = "Super Missionarie!"
         }
             );
         context.SaveChanges();
     }
 }
예제 #2
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new ScripturesJournalContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <ScripturesJournalContext> >()))
            {
                // Look for any movies.
                if (context.Scripture.Any())
                {
                    return;   // DB has been seeded
                }

                context.Scripture.AddRange(
                    new Scripture
                {
                    Title     = "Nephi",
                    Book      = "1st Nephi",
                    Chapters  = "3",
                    Verses    = "3",
                    Note      = "I am a child of God",
                    DateAdded = DateTime.Parse("2019-6-06")
                },

                    new Scripture
                {
                    Title     = "Repentance",
                    Book      = "2nd Nephi",
                    Chapters  = "4",
                    Verses    = "12",
                    Note      = "I am a child of God",
                    DateAdded = DateTime.Parse("2019-6-06")
                },

                    new Scripture
                {
                    Title     = "Lehi",
                    Book      = "Moroni",
                    Chapters  = "2",
                    Verses    = "3-4",
                    Note      = "I am a child of God",
                    DateAdded = DateTime.Parse("2019-6-06")
                },

                    new Scripture
                {
                    Title     = "Moroni",
                    Book      = "Alma",
                    Chapters  = "26",
                    Verses    = "12",
                    Note      = "I am a child of God",
                    DateAdded = DateTime.Parse("2019-6-06")
                }
                    );
                context.SaveChanges();
            }
        }
예제 #3
0
 public IndexModel(ScripturesJournal.Models.ScripturesJournalContext context)
 {
     _context = context;
 }
예제 #4
0
 public DetailsModel(ScripturesJournal.Models.ScripturesJournalContext context)
 {
     _context = context;
 }
예제 #5
0
 public CreateModel(ScripturesJournal.Models.ScripturesJournalContext context)
 {
     _context = context;
 }