Exemplo n.º 1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new LukasPagesMovieContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <LukasPagesMovieContext> >()))
            {
                // Look for any movies.
                if (context.Movie.Any())
                {
                    return;       // DB has been seeded
                }

                context.Movie.AddRange(
                    new Movie
                {
                    Title       = "Avengers: Endgame",
                    ReleaseDate = DateTime.Parse("2019-4-25"),
                    Genre       = "Fantasy",
                },

                    new Movie
                {
                    Title       = "Captain Marvel ",
                    ReleaseDate = DateTime.Parse("2019-1-1"),
                    Genre       = "Adventure",
                },

                    new Movie
                {
                    Title       = "Us",
                    ReleaseDate = DateTime.Parse("2019-5-15"),
                    Genre       = "Comedy",
                },

                    new Movie
                {
                    Title       = "Leaving Neverland",
                    ReleaseDate = DateTime.Parse("2019-2-12"),
                    Genre       = "Biography",
                }
                    );
                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
 public EditModel(LukasPagesMovie.Models.LukasPagesMovieContext context)
 {
     _context = context;
 }
Exemplo n.º 3
0
 public DeleteModel(LukasPagesMovie.Models.LukasPagesMovieContext context)
 {
     _context = context;
 }
Exemplo n.º 4
0
 public IndexModel(LukasPagesMovie.Models.LukasPagesMovieContext context)
 {
     _context = context;
 }