public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "The R.M.", ReleaseDate = DateTime.Parse("2003-1-31"), Genre = "Comedy", Rating = "PG", Price = 1.112M, }, new Movie { Title = "The Other Side of Heaven", ReleaseDate = DateTime.Parse("2001-12-14"), Genre = "Drama", Rating = "PG", Price = 4.8M }, new Movie { Title = "Meet the Mormons", ReleaseDate = DateTime.Parse("2014-10-10"), Genre = "Documentary", Rating = "PG", Price = 6.047M }, new Movie { Title = "The Best Two Years", ReleaseDate = DateTime.Parse("2004-2-20"), Genre = "Comedy-Drama", Rating = "PG", Price = .5M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "17 Miracles", ReleaseDate = DateTime.Parse("2011-6-03"), Genre = "History", Price = 12.99M, Rating = "PG" }, new Movie { Title = "The Other Side of Heaven", ReleaseDate = DateTime.Parse("2001-12-13"), Genre = "Drama", Price = 10.99M, Rating = "PG" }, new Movie { Title = "The Other Side of Heaven 2", ReleaseDate = DateTime.Parse("2019-6-28"), Genre = "Drama", Price = 19.99M, Rating = "PG-13" }, new Movie { Title = "The Singles Ward", ReleaseDate = DateTime.Parse("2002-2-1"), Genre = "Comedy", Price = 8.99M, Rating = "PG" } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "The Work and the Glory", ReleaseDate = DateTime.Parse("2004-3-11"), Genre = "Historical Fiction", Price = 10.99M, Rating = "G" }, new Movie { Title = "Once I Was a Beehive ", ReleaseDate = DateTime.Parse("2015-8-14"), Genre = "Family Comedy", Price = 14.99M, Rating = "PG" }, new Movie { Title = "The Single Ward", ReleaseDate = DateTime.Parse("2002-02-01"), Genre = "Religious Comedy", Price = 5.99M, Rating = "PG" }, new Movie { Title = "The Saratov Approach", ReleaseDate = DateTime.Parse("2013-10-01"), Genre = "Drama Action", Price = 7.99M, Rating = "PG13" } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext(serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { var total = 0; var count = 0; // Look for any movies if (context.Movie.Any()) { return; // If movies then Db has been seeded so return. } else { context.Movie.AddRange( new Movie { Title = "When Harry Met Sally", ReleaseDate = DateTime.Parse("1989-1-11"), Genre = "Romantic Comedy", Rating = "R", Price = 7.99M }, new Movie { Title = "Ghostbusters ", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = "Comedy", Rating = "PG", Price = 8.99M }, new Movie { Title = "Ghostbusters 2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comedy", Rating = "PG", Price = 9.99M }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Rating = "PG", Price = 3.99M } ); count = context.SaveChanges(); Console.WriteLine($"{count} Movie records added."); } } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "The Best two years", ReleaseDate = DateTime.Parse("2006-1-11"), Genre = "Comedy", Rating = "A", Price = 7.99M }, new Movie { Title = "The RM ", ReleaseDate = DateTime.Parse("2003-3-13"), Genre = "Comedy", Rating = "A", Price = 8.99M }, new Movie { Title = "The Other Side of Heaven", ReleaseDate = DateTime.Parse("2001-2-23"), Genre = "Inspirational", Rating = "A", Price = 9.99M }, new Movie { Title = "Finding Faith in Christ", ReleaseDate = DateTime.Parse("2002-4-15"), Genre = "Gospel", Rating = "A", Price = 3.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "The Life of Jesus Christ Bible Videos", ReleaseDate = DateTime.Parse("2012-2-12"), Genre = "Religous", Price = 9.99M, Rating = "G" }, new Movie { Title = "The Cokeville Miracle", ReleaseDate = DateTime.Parse("2015-6-5"), Genre = "Drama", Price = 19.99M, Rating = "PG-13" }, new Movie { Title = "Return With Honor", ReleaseDate = DateTime.Parse("2006-1-26"), Genre = "Drama", Price = 9.99M, Rating = "PG-13" }, new Movie { Title = "The Singles 2nd Ward", ReleaseDate = DateTime.Parse("2007-12-11"), Genre = "Comedy", Price = 11.99M, Rating = "PG" } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "The Singles Ward", ReleaseDate = DateTime.Parse("2002-2-1"), Genre = "Romantic Comedy", Rating = "PG", Price = 7.99M }, new Movie { Title = "The RM", ReleaseDate = DateTime.Parse("2003-1-31"), Genre = "Comedy", Rating = "PG", Price = 8.99M }, new Movie { Title = "The Best Two Years", ReleaseDate = DateTime.Parse("2003-2-23"), Genre = "Comedy Drama", Rating = "PG", Price = 9.99M }, new Movie { Title = "Baptists at Our Barbecue", ReleaseDate = DateTime.Parse("2004-10-8"), Genre = "Comedy", Rating = "PG", Price = 3.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Other Side of Heaven", ReleaseDate = DateTime.Parse("1989-2-12"), Genre = "Comedy", Rating = "PG", Price = 7.99M }, new Movie { Title = "The RM", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = "Comedy", Rating = "G", Price = 8.99M }, new Movie { Title = "Meet the Mormons", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Documentary", Rating = "G", Price = 9.99M }, new Movie { Title = "Ephraim's Rescue", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Rating = "PG", Price = 3.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "The Errand of Angels", ReleaseDate = DateTime.Parse("2008-2-12"), Genre = "Drama", Price = 7.99M, Rating = "PG-13" }, new Movie { Title = "The Singles 2nd Ward", ReleaseDate = DateTime.Parse("2007-3-13"), Genre = "Comedy", Price = 8.99M, Rating = "G" }, new Movie { Title = "The R.M.", ReleaseDate = DateTime.Parse("2003-2-23"), Genre = "Comedy", Price = 9.99M, Rating = "PG-13" }, new Movie { Title = "The Book of Mormon Movie", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Adventure", Price = 3.99M, Rating = "G" } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Meet the Mormons", ReleaseDate = DateTime.Parse("2014-10-10"), Genre = "Documentary", Rating = "G", Price = 7.72M }, new Movie { Title = "The First Vision ", ReleaseDate = DateTime.Parse("1976-6-8"), Genre = "Drama", Rating = "G", Price = 7.92M }, new Movie { Title = "The Life of Jesus Christ", ReleaseDate = DateTime.Parse("1992-2-23"), Genre = "Historical", Rating = "G", Price = 7.99M }, new Movie { Title = "17 Miracles", ReleaseDate = DateTime.Parse("2011-4-15"), Genre = "History/Adventure", Rating = "G", Price = 6.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "The Singles Ward", ReleaseDate = DateTime.Parse("2002-2-1"), Genre = "Romantic Comedy", Rating = "PG", Price = 7.99M }, new Movie { Title = "The Singles 2nd Ward", ReleaseDate = DateTime.Parse("2007-12-11"), Genre = "Romantic Comedy", Rating = "PG", Price = 7.99M }, new Movie { Title = "The R.M", ReleaseDate = DateTime.Parse("2003-1-31"), Genre = "Comedy", Rating = "PG", Price = 9.99M }, new Movie { Title = "17 Miracles", ReleaseDate = DateTime.Parse("2011-6-3"), Genre = "Inspirational", Rating = "PG", Price = 3.99M } ); context.SaveChanges(); } }
public static void Initialise(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { MovieTitle = "Career Opportunities", ReleaseDate = DateTime.Parse("1991-2-12"), Genre = "Romantic Comedy", Rating = "G", Price = 40.99M }, new Movie { MovieTitle = "Terminator", ReleaseDate = DateTime.Parse("1984-11-27"), Genre = "Horror Action", Rating = "R", Price = 56.89M }, new Movie { MovieTitle = "Avengers", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comix Movie", Rating = "PG-13", Price = 49.99M }, new Movie { MovieTitle = "Amazon Series", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Series", Rating = "PG-13", Price = 19.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Napoelon Dynamite", ReleaseDate = DateTime.Parse("1989-2-12"), Genre = "Comedy", Rating = "PG", Price = 7.99M }, new Movie { Title = "Singles Ward 2 ", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = "Romantic Comedy", Rating = "PG", Price = 8.99M }, new Movie { Title = "Baptists at Our Barbecue", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Romantic Comedy", Rating = "PG", Price = 9.99M }, new Movie { Title = " Saints and Soldiers", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "War", Rating = "M", Price = 3.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Meet the Mormons", ReleaseDate = DateTime.Parse("2015-2-25"), Genre = "Documentary", Price = 7.99M, Rating = "PG" }, new Movie { Title = "The R.M.", ReleaseDate = DateTime.Parse("2003-1-31"), Genre = "Comedy", Price = 8.99M, Rating = "PG" }, new Movie { Title = "The Other Side of Heaven", ReleaseDate = DateTime.Parse("2002-4-12"), Genre = "Drama", Price = 9.99M, Rating = "PG" }, new Movie { Title = "The Singles Ward", ReleaseDate = DateTime.Parse("2002-1-30"), Genre = "Comedy", Price = 3.99M, Rating = "PG" } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Sell.Any()) { return; // DB has been seeded } context.Sell.AddRange( new Sell { s_name = "썬더 G", SellDate = DateTime.Parse("1989-2-12"), s_amount = 28, Price = 120000, Rating = "70%" }, new Sell { s_name = "썬더 K", SellDate = DateTime.Parse("1990-2-12"), s_amount = 28, Price = 120000, Rating = "13%" }, new Sell { s_name = "썬더 L", SellDate = DateTime.Parse("1999-2-12"), s_amount = 28, Price = 120000, Rating = "15%" }, new Sell { s_name = "썬더 J", SellDate = DateTime.Parse("2001-2-12"), s_amount = 28, Price = 120000, Rating = "70%" } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "When Harry Met Sally", ReleaseDate = DateTime.Parse("1989-2-12"), Genre = "Romantic Comedy", Rating = "R", Price = 7.99M }, new Movie { Title = "Ghostbusters ", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = "Comedy", Rating = "PG", Price = 9.99M }, new Movie { Title = "Ghostbusters 2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comedy", Rating = "PG", Price = 9.99M }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Rating = "N/A", Price = 3.99M } ); context.SaveChanges(); } }
public static Task SetContextIdsAsync(MvcMovieContext context) { var timer = new Stopwatch(); timer.Start(); foreach (Movies m in context.Movies) { var movieId = (from mov in context.Movies where mov.Title.Equals(m.Title) select mov.Id).FirstOrDefault(); var info = m.Info; info.MovieId = m.Id; } context.SaveChanges(); foreach (Movies m2 in context.Movies) { var info2 = m2.Info; var infoId = (from mov in context.Movies where mov.Id.Equals(info2.MovieId) select mov.Info.Id).FirstOrDefault(); var actors = m2.Info.Actors; var directors = m2.Info.Directors; var genres = m2.Info.Genres; foreach (Actors a in actors) { a.InfoId = infoId; } foreach (Directors d in directors) { d.InfoId = infoId; } foreach (Genres g in genres) { g.InfoId = infoId; } } context.SaveChanges(); timer.Stop(); log.Info(string.Format("SetContextIdsAsync - completed adding Ids to Movies in separate thread and saving to DB: {0} ms have elapsed.", timer.ElapsedMilliseconds.ToString())); // Dispose this context, we don't need it anymore it was only for seeding data context.Dispose(); return(null); }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Titulo = "When Harry Met Sally", DataLancamento = DateTime.Parse("1989-1-11"), Genero = "Romantic Comedy", Preco = 7.99M, Avaliacao = "R" }, new Movie { Titulo = "Ghostbusters ", DataLancamento = DateTime.Parse("1984-3-13"), Genero = "Comedy", Preco = 8.99M, Avaliacao = "B" }, new Movie { Titulo = "Ghostbusters 2", DataLancamento = DateTime.Parse("1986-2-23"), Genero = "Comedy", Preco = 9.99M, Avaliacao = "R" }, new Movie { Titulo = "Rio Bravo", DataLancamento = DateTime.Parse("1959-4-15"), Genero = "Western", Preco = 3.99M, Avaliacao = "B" } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Thor: Ragnarok", ReleaseDate = DateTime.Parse("2017-11-3"), Genre = "Action/SciFi", Rating = "PG-13", Price = 9.99M }, new Movie { Title = "Pitch Perfect", ReleaseDate = DateTime.Parse("2012-9-28"), Genre = "Comedy", Rating = "PG-13", Price = 4.99M }, new Movie { Title = "The Sandlot", ReleaseDate = DateTime.Parse("1993-4-1"), Genre = "Drama", Rating = "PG", Price = 2.99M }, new Movie { Title = "Clueless", ReleaseDate = DateTime.Parse("1995-7-19"), Genre = "Teen Romance", Rating = "PG-13", Price = 3.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider provider) { using (var context = new MvcMovieContext( provider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // look for the movies if (context.Movie.Any()) { return; // DB was already seeded if it goes to here } context.Movie.AddRange( new Movie { Title = "When Harry Met Sally", ReleaseDate = DateTime.Parse("1989-1-11"), Genre = "Romantic Comedy", Price = 7.99M, Rating = "R" }, new Movie { Title = "Ghostbusters ", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = "Comedy", Price = 8.99M, Rating = "PG" }, new Movie { Title = "Ghostbusters 2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comedy", Price = 9.99M, Rating = "PG-13" }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Price = 3.99M, Rating = "G" } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Suits on the Loose", ReleaseDate = DateTime.Parse("2005-10-14"), Genre = "Comedy", Price = 7.99M, Rating = "PG" }, new Movie { Title = "The Home Teachers", ReleaseDate = DateTime.Parse("2004-1-9"), Genre = "Comedy", Price = 8.99M, Rating = "PG" }, new Movie { Title = "The Book of Mormon Volume 1: The Journey", ReleaseDate = DateTime.Parse("2004-1-12"), Genre = "Adventure", Price = 9.99M, Rating = "PG" }, new Movie { Title = "17 Miracles", ReleaseDate = DateTime.Parse("2011-6-3"), Genre = "History", Price = 3.99M, Rating = "PG" } ); context.SaveChanges(); } }
//public static void Initialize(MvcMovieContext context) //{ // { // if (context.Movie.Any()) // { // return; // DB has been seeded // } // context.Add(new Movie // { // Title = "God Father", // Genre = "Drama/Crime", // Price = 249, // ReleaseDate = new DateTime(1972, 05, 24) // }); // context.SaveChanges(); // } //} public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Lord of the rings 3", ReleaseDate = DateTime.Parse("2007-7-11"), Genre = "Fantasy/Action", Rating = "R", Price = 117.99M }, new Movie { Title = "Transformers 5", ReleaseDate = DateTime.Parse("2017-4-13"), Genre = "Fantasy/Action/Animation", Rating = "M", Price = 58.99M }, new Movie { Title = "Braveheart", ReleaseDate = DateTime.Parse("1995-5-24"), Genre = "History/Action", Rating = "R", Price = 49.99M }, new Movie { Title = "Rio 2", ReleaseDate = DateTime.Parse("2015-6-15"), Genre = "Animation", Rating = "J", Price = 34.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Book of Mormon Movie", ReleaseDate = DateTime.Parse("1989-1-11"), Genre = "Comedy", Rating = "PG", Price = 7.99M }, new Movie { Title = "The RM", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = "Comedy", Rating = "PG", Price = 8.99M }, new Movie { Title = "Brigham City", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Mormon", Rating = "PG", Price = 9.99M }, new Movie { Title = "Cokeville Miracle", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Family", Rating = "PG", Price = 3.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Meet the Mormons", ReleaseDate = DateTime.Parse("2015-2-26"), Genre = "Documentary", Rating = "PG", Price = 9.99M }, new Movie { Title = "The Saratov Approach", ReleaseDate = DateTime.Parse("2013-10-9"), Genre = "Action", Rating = "PG-13", Price = 19.99M }, new Movie { Title = "17 Miracles", ReleaseDate = DateTime.Parse("2011-6-7"), Genre = "Adventure", Rating = "PG", Price = 19.99M }, new Movie { Title = "Saturday's Warrior", ReleaseDate = DateTime.Parse("2016-4-1"), Genre = "Musical", Rating = "PG", Price = 19.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Meet the Mormons", ReleaseDate = DateTime.Parse("2014-10-10"), Genre = "Documentary", Rating = "PG", Price = 4.98M }, new Movie { Title = "17 Miracles", ReleaseDate = DateTime.Parse("2011-6-3"), Genre = "Adventure", Rating = "PG", Price = 11.99M }, new Movie { Title = "Singles Ward", ReleaseDate = DateTime.Parse("2002-1-30"), Genre = "Comedy", Rating = "PG", Price = 19.99M }, new Movie { Title = "The Other Side of Heaven", ReleaseDate = DateTime.Parse("2002-4-12"), Genre = "Adventure", Rating = "PG", Price = 12.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "17 Miracles", ReleaseDate = DateTime.Parse("2011-6-3"), Genre = "Adventure", Rating = "PG", Price = 17.99M }, new Movie { Title = "Ephraim's Rescue", ReleaseDate = DateTime.Parse("2013-5-31"), Genre = "Adventure", Rating = "PG", Price = 18.99M }, new Movie { Title = "The Best Two Years", ReleaseDate = DateTime.Parse("2004-2-20"), Genre = "Comedy", Rating = "PG", Price = 9.99M }, new Movie { Title = "The Saratov Approach", ReleaseDate = DateTime.Parse("2013-10-9"), Genre = "Drama", Rating = "PG-13", Price = 13.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { // GetRequiredService is imported from : using Microsoft.Extensions.DependencyInjection; using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies -- if found, do nothing if (context.Movie.Any()) { return; } context.Movie.AddRange( new Movie { Title = "When Harry Met Sally", ReleaseDate = DateTime.Parse("1989-1-11"), Genre = "Romatic Comedy", Rating = "R", Price = 7.99M }, new Movie { Title = "Ghostbuster", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = "Comedy", Rating = "R", Price = 8.99M }, new Movie { Title = "Ghostbuster-2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Romatic Comedy", Rating = "R", Price = 9.99M }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Rating = "R", Price = 3.99M } ); // Adding to the database context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { if (context.Movie.Any()) { return; } context.Movie.AddRange( new Movie { Title = "When Harry Met Sally", ReleaseDate = DateTime.Parse("1999-2-12"), Genre = "Romantic Comedy", Rating = "R", Price = 7.99M }, new Movie { Title = "Ghostbusters", ReleaseDate = DateTime.Parse("1994-3-14"), Genre = "Action", Rating = "R", Price = 6.55M }, new Movie { Title = "Oblivion", ReleaseDate = DateTime.Parse("2016-05-04"), Genre = "SF", Rating = "G", Price = 9.00M }, new Movie { Title = "Rio", ReleaseDate = DateTime.Parse("2017-03-20"), Genre = "Animation", Rating = "G", Price = 7.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "When Harry Met Sally", ReleaseDate = DateTime.Parse("1989-1-11"), Genre = "Romantic Comedy", Price = 7.99M, QualityType = Movie.Quality.FULLHD_1080p }, new Movie { Title = "Ghostbusters ", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = "Comedy", Price = 8.99M, QualityType = Movie.Quality.HDREADY_720p }, new Movie { Title = "Ghostbusters 2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comedy", Price = 9.99M, QualityType = Movie.Quality.ULTRAHD_2160p }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Price = 3.99M, QualityType = Movie.Quality.ULTRAHD_2160p } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Emma Smith: My Story", ReleaseDate = DateTime.Parse("2008-4-11"), Genre = "Biography", Price = 14.99M, Rating = "PG" }, new Movie { Title = "Forever Strong", ReleaseDate = DateTime.Parse("2008-9-26"), Genre = "Drama", Price = 19.99M, Rating = "PG-13" }, new Movie { Title = "Once I Was a Beehive", ReleaseDate = DateTime.Parse("2015-8-14"), Genre = "Comedy", Price = 9.99M, Rating = "PG" }, new Movie { Title = "The Errand of Angels", ReleaseDate = DateTime.Parse("2008-8-22"), Genre = "Drama", Price = 14.99M, Rating = "PG" } ); context.SaveChanges(); } }