예제 #1
0
        public static void Initialize(MoviesDbContext context)
        {
            context.Database.EnsureCreated();

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

            context.Movies.AddRange(
                new Movie
            {
                Title       = "telefon",
                Description = "White, Yellow",
                Genre       = "action",
                Director    = "Ana",
                Duration    = 100,
                Year        = 1999,
                Date        = DateTime.Now,
                Rating      = 9,
                Watched     = "yes"
            },
                new Movie
            {
                Title       = "Titanic",
                Description = "a big boat",
                Genre       = "drama",
                Director    = "Ana",
                Duration    = 100,
                Year        = 2001,
                Date        = DateTime.Now,
                Rating      = 10,
                Watched     = "no"
            },
                new Movie
            {
                Title       = "Vals",
                Description = "a big boat",
                Genre       = "drama",
                Director    = "Ana",
                Duration    = 100,
                Year        = 2001,
                Date        = DateTime.Now,
                Rating      = 10,
                Watched     = "no"
            }
                );
            context.SaveChanges();
        }
예제 #2
0
        public static void Initialize(MoviesDbContext context)
        {
            context.Database.EnsureCreated();

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

            context.Movies.AddRange(
                new Movie
            {
                Title         = "Titanic",
                Description   = "Ship sinks",
                MovieGenre    = MovieGenre.action,
                Duration      = 195,
                YearOfRelease = 1997,
                Director      = "James Cameron",
                DateAdded     = DateTime.Parse("3/4/2019 19:53"),
                Rating        = 9,
                MovieWatched  = MovieWatched.yes
            },
                new Movie
            {
                Title         = "2001: A Space Odyssey",
                Description   = "Black structure provides connection between past and future",
                MovieGenre    = MovieGenre.action,
                Duration      = 164,
                YearOfRelease = 1968,
                Director      = "Stanley Kubrick",
                DateAdded     = DateTime.Parse("1/5/2019 12:53"),
                Rating        = 9,
                MovieWatched  = MovieWatched.no
            }
                );
            context.SaveChanges();
        }
예제 #3
0
        public static void Initialize(MoviesDbContext context)
        {
            context.Database.EnsureCreated();

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

            context.Movies.AddRange(
                new Movie
            {
                Title             = "Movie1",
                Description       = "Description1",
                Genre             = Genre.action,
                DurationInMinutes = 120,
                YearOfRelease     = 2017,
                Director          = "Director1",
                Rating            = 10,
                Watched           = Watched.yes
            },
                new Movie
            {
                Title             = "Movie2",
                Description       = "Description2",
                Genre             = Genre.comedy,
                DurationInMinutes = 110,
                YearOfRelease     = 2018,
                Director          = "Director2",
                Rating            = 9,
                Watched           = Watched.no
            }
                );
            context.SaveChanges();
        }