public static void Initialize(IServiceProvider serviceProvider) { Console.WriteLine("seed initialize"); using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Movie.Any()) { Console.WriteLine("movies exist in DB"); return; // DB has been seeded } Console.WriteLine("movies don't exist in DB"); context.Movie.AddRange( new Movie { Title = "The Chosen", ReleaseDate = DateTime.Parse("2017-12-24"), Genre = "Historical", Price = 1.00M, Rating = "TV-PG", ImageUrl = "https://i2.wp.com/www.kevinhalloran.net/wp-content/uploads/2020/05/maxresdefault.jpg" }, new Movie { Title = "Ephraim's Rescue", ReleaseDate = DateTime.Parse("2013-5-31"), Genre = "Historical", Price = 15.99M, Rating = "PG", ImageUrl = "https://resizing.flixster.com/EVwsQg_QPQXWjb0_NXSQz1OZOLQ=/300x300/v2/https://flxt.tmsimg.com/assets/p9975618_v_h9_aa.jpg" }, new Movie { Title = "Meet the Mormons", ReleaseDate = DateTime.Parse("2014-10-10"), Genre = "Documentary", Price = 1.85M, Rating = "PG", ImageUrl = "https://static.tumblr.com/qur1lcd/PXWnak3kc/social_image.jpg" }, new Movie { Title = "The Cokeville Miracle", ReleaseDate = DateTime.Parse("2015-6-5"), Genre = "Historical", Price = 8.87M, Rating = "PG-13", ImageUrl = "https://upload.wikimedia.org/wikipedia/en/thumb/f/ff/Thecokevillemiracleposter.jpg/220px-Thecokevillemiracleposter.jpg" }, new Movie { Title = "The Best Two Years", ReleaseDate = DateTime.Parse("2003-1-1"), Genre = "Comedy", Price = 19.65M, Rating = "PG", ImageUrl = "https://images-na.ssl-images-amazon.com/images/I/515H97tpKAL._AC_.jpg" }, new Movie { Title = "God's Not Dead", ReleaseDate = DateTime.Parse("2014-3-21"), Genre = "Inspirational", Price = 5.00M, Rating = "PG", ImageUrl = "https://upload.wikimedia.org/wikipedia/en/c/cf/God%27s_Not_Dead.jpg" } ); 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 Other Side of Heaven", ReleaseDate = DateTime.Parse("2001-12-14"), Genre = "Missionary", Image = "https://lumiere-a.akamaihd.net/v1/images/open-uri20150422-12561-1h7kvyj_5079fa1a.jpeg", Price = 5.07M, Rating = "PG" }, new Movie { Title = "The Testaments: of One Fold and One Shepherd", ReleaseDate = DateTime.Parse("2000-3-24"), Genre = "Book of Mormon", Image = "https://images-na.ssl-images-amazon.com/images/I/81-JS4j1zbL._AC_SL1500_.jpg ", Price = 5.07M, Rating = "Unrated" }, new Movie { Title = "Joseph Smith: The Prophet of the Restoration", ReleaseDate = DateTime.Parse("2005-12-1"), Genre = "Restoration", Image = "https://assets.ldscdn.org/8b/7a/8b7a1e906d59d7b2608a3ac8ec0f8a4bcd1b60e3/joseph_smith_the_prophet_of_the_restoration.jpeg", Price = 7.99M, Rating = "Unrated" }, new Movie { Title = "Ephraim's Rescue", ReleaseDate = DateTime.Parse("2013-5-31"), Genre = "Pioneers", Image = "https://d1hdlz9ljonw49.cloudfront.net/product-images/000/715/548/detail/Ephraims_Rescue_DVD.jpg?1447880052", Price = 11.99M, Rating = "PG" }, new Movie { Title = "17 Miracles", ReleaseDate = DateTime.Parse("2011-6-3"), Genre = "Pioneers", Image = "https://bloximages.chicago2.vip.townnews.com/heraldextra.com/content/tncms/assets/v3/editorial/1/26/126fd491-b84b-5df4-95c4-953889c012df/578efd5f3a57f.image.jpg", Price = 9.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 = "Best Two Years", ReleaseDate = DateTime.Parse("2004-2-20"), Genre = "Comedy, Drama", Rating = "PG-13", Price = 9.99M }, new Movie { Title = "Joseph Smith: Prophet of the Restoration", ReleaseDate = DateTime.Parse("2005-1-1"), Genre = "Biography, Drama, History", Rating = "None", Price = 9.99M }, new Movie { Title = "The Other Side of Heaven", ReleaseDate = DateTime.Parse("2002-4-12"), Genre = "Adventure, Biography, Drama", Rating = "PG", Price = 14.98M }, new Movie { Title = "Trek: The Movie", ReleaseDate = DateTime.Parse("2008-4-6"), Genre = "Comedy, Drama, Family", Rating = "PG", Price = 19.99M }, new Movie { Title = "Come Unto Me", ReleaseDate = DateTime.Parse("2014-4-1"), Genre = "Short, Drama, Family", Rating = "None", Price = 4.99M }, new Movie { Title = "17 Miracles", ReleaseDate = DateTime.Parse("2011-6-3"), Genre = "Adventure, History", Rating = "PG", Price = 14.99M } ); context.SaveChanges(); } }
public IndexModel(MvcMovie.Models.MvcMovieContext context, ILogger <IndexModel> logger) { _context = context; _logger = logger; }
public CreateModel(MvcMovie.Models.MvcMovieContext context) { _context = context; }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. // si la peli ya existe en la base de datos, no se agrega 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 = "Good", Price = 8.99M }, new Movie { Title = "Ghostbusters 2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comedy", Rating = "Good", Price = 9.99M }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Rating = "R", Price = 3.99M }, new Movie { Title = "Toy Story", ReleaseDate = DateTime.Parse("1959-7-25"), Genre = "Animation", Rating = "Good", Price = 2.99M }, new Movie { Title = "Ariel", ReleaseDate = DateTime.Parse("1975-9-1"), Genre = "Animation", Rating = "R", Price = 5.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-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 = 8.99M }, new Movie { Title = "Ghostbusters 2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comedy", Rating = "PG-13", Price = 9.99M }, new Movie { Title = "The Dark Knight", ReleaseDate = DateTime.Parse("2008-7-18"), Genre = "Action", Rating = "10/10", Price = 12.97M }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Rating = "G", 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 R.M.", ReleaseDate = DateTime.Parse("2003-1-31"), MovieGenre = Movie.Genre.Romance, Rating = "PG", Price = 7.99M }, new Movie { Title = "The Other Side of Heaven", ReleaseDate = DateTime.Parse("2001-12-14"), MovieGenre = Movie.Genre.Drama, Rating = "PG", Price = 8.99M }, new Movie { Title = "The Other Side of Heaven 2", ReleaseDate = DateTime.Parse("2019-6-28"), MovieGenre = Movie.Genre.Drama, Rating = "PG-13", Price = 9.99M }, new Movie { Title = "Meet the Mormons", ReleaseDate = DateTime.Parse("2019-6-28"), MovieGenre = Movie.Genre.Documentary, Rating = "PG", Price = 9.99M }, new Movie { Title = "The Best Two Years", ReleaseDate = DateTime.Parse("2004-2-20"), MovieGenre = Movie.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.Genre.AddRange( new Genre { GenreName = "Action" }, new Genre { GenreName = "Drama" }, new Genre { GenreName = "Comedy" }, new Genre { GenreName = "Animated" }, new Genre { GenreName = "Adventure" }, new Genre { GenreName = "Music" }, new Genre { GenreName = "Documentary" }, new Genre { GenreName = "Biographical" } ); context.SaveChanges(); context.Movie.AddRange( new Movie { Title = "The R.M.", ReleaseDate = DateTime.Parse("2003-1-31"), Genre = context.Genre.Where(e => e.GenreName == "Comedy").FirstOrDefault(), Price = 7.99M, Rating = "PG", ImageUrl = "https://m.media-amazon.com/images/M/MV5BMTI4NzQ1OTMyNV5BMl5BanBnXkFtZTYwMTE1NzQ3._V1_UY1200_CR92,0,630,1200_AL_.jpg" }, new Movie { Title = "The Other Side of Heaven", ReleaseDate = DateTime.Parse("2001-12-14"), Genre = context.Genre.Where(e => e.GenreName == "Adventure").FirstOrDefault(), Price = 6.99M, Rating = "PG", ImageUrl = "https://upload.wikimedia.org/wikipedia/en/thumb/1/11/The_Other_Side_of_Heaven_theatrical_poster.png/220px-The_Other_Side_of_Heaven_theatrical_poster.png" }, new Movie { Title = "Meet the Mormons", ReleaseDate = DateTime.Parse("2014-10-10"), Genre = context.Genre.Where(e => e.GenreName == "Documentary").FirstOrDefault(), Price = 8.99M, Rating = "PG", ImageUrl = "https://upload.wikimedia.org/wikipedia/en/1/17/Meet_the_Mormons_poster.jpg" } ); context.SaveChanges(); } }
public DetailsModel(MvcMovie.Models.MvcMovieContext context) { _context = context; }
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, Actors = new List <Actor>() { new Actor { FirstName = "Billy", LastName = "Crystal" }, new Actor { FirstName = "Meg", LastName = "Ryan" }, new Actor { FirstName = "Carry", LastName = "Fisher" } } }, new Movie { Title = "Ghostbusters ", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = "Comedy", Price = 8.99M }, new Movie { Title = "Ghostbusters 2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comedy", Price = 9.99M }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Price = 3.99M } ); context.SaveChanges(); } }
public IndexModel(MvcMovie.Models.MvcMovieContext context) { _context = context; }
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-13", Price = 7.99M, Image = "miracles.jpg" }, new Movie { Title = "Joseph Smith: The Prophet of the Restoration", ReleaseDate = DateTime.Parse("2005-12-24"), Genre = "Drama", Rating = "NR", Price = 8.99M, Image = "smith.jpg" }, new Movie { Title = "Charly", ReleaseDate = DateTime.Parse("2002-9-20"), Genre = "Drama", Rating = "PG-13", Price = 9.99M, Image = "charly.jpg" }, new Movie { Title = "The other Side of Heaven", ReleaseDate = DateTime.Parse("2002-4-12"), Genre = "Adventure", Rating = "PG-13", Price = 9.99M, Image = "heaven.jpg" }, new Movie { Title = "Saints and Soldiers", ReleaseDate = DateTime.Parse("2005-3-25"), Genre = "Action", Rating = "PG-13", Price = 7.99M, Image = "soldiers.jpg" } ); 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 = "Finding Faith in Christ", ReleaseDate = DateTime.Parse("2004-1-01"), Price = 7.99M, Genre = "Action", Rating = "PG-13", Image = "../../image/1_img.jpg" }, new Movie { Title = "Johnny Lingo", ReleaseDate = DateTime.Parse("2011-5-01"), Price = 8.99M, Genre = "Comedy", Rating = "PG-13", Image = "../../image/2_img.jpg" }, new Movie { Title = "Joseph Smith: Prophet of the Restoration", ReleaseDate = DateTime.Parse("2006-5-01"), Price = 9.99M, Genre = "Romantic", Rating = "PG-10", Image = "../../image/3_img.jpg" }, new Movie { Title = "Man's Search for Happiness", ReleaseDate = DateTime.Parse("2016-10-02"), Price = 3.99M, Genre = "Drama", Rating = "PG-09", Image = "../../image/4_img.jpg" }, new Movie { Title = "Meet the Mormons", ReleaseDate = DateTime.Parse("2015-05-01"), Price = 3.99M, Genre = "Romantic", Rating = "PG-00", Image = "../../image/5_img.jpg" }, new Movie { Title = "On the Lord's Errand: The Life of Thomas S. Monson", ReleaseDate = DateTime.Parse("2009-09-01"), Price = 3.99M, Genre = "Action", Rating = "PG-04", Image = "../../image/6_img.jpg" }, new Movie { Title = "Only a Stonecutter", ReleaseDate = DateTime.Parse("2010-07-01"), Price = 3.99M, Genre = "Action", Rating = "PG-25", Image = "../../image/7_img.jpg" } ); 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("10-10-2014"), Genre = "Documentary", Rating = "PG", Price = 9.99M }, new Movie { Title = "17 Miracles", ReleaseDate = DateTime.Parse("6-3-2011"), Genre = "History", Rating = "PG", Price = 4.99M }, new Movie { Title = "The Saratov Approach", ReleaseDate = DateTime.Parse("4-4-2014"), Genre = "Action", Rating = "PG-13", Price = 14.99M }, new Movie { Title = "The Singles Ward", ReleaseDate = DateTime.Parse("1-30-2002"), Genre = "Romantic Comedy", Rating = "PG", Price = 0.99M }, new Movie { Title = "Saints and Soldiers", ReleaseDate = DateTime.Parse("9-11-2003"), Genre = "Drama", Rating = "PG-13", Price = 19.99M }, new Movie { Title = "The Best Two Years", ReleaseDate = DateTime.Parse("2-20-2004"), Genre = "Comedy Drama", Rating = "PG", Price = 29.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any genres /*if (context.Genre.Any()) * { * return; * } * * context.Genre.AddRange( * new Genre * { * Description = "Romantic Comedy" * }, * * new Genre * { * Description = "History" * }, * * new Genre * { * Description = "Adventure" * }, * * new Genre * { * Description = "Reality" * } * );*/ // Look for any movies. if (context.Movie.Any()) { return; // DB has been seeded } context.Movie.AddRange( new Movie { Title = "Charlie", ReleaseDate = DateTime.Parse("1989-2-12"), Genre = new Genre { Description = "Romantic Comedy" }, Price = 7.99M }, new Movie { Title = "The Book of Mormon", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = new Genre { Description = "Reality" }, Price = 8.99M }, new Movie { Title = "The RM", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = new Genre { Description = "Comedy" }, Price = 9.99M }, new Movie { Title = "The Other Side of Heaven", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = new Genre { Description = "Adventure" }, 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() && context.Reviews.Any()) { return; // DB has been seeded } context.Reviews.AddRange( new Reviews { //ReviewId = 1, Author = "Matt", Review = "good", MovieID = 4 //Title = "When Harry Met Sally" }, new Reviews { //ReviewId = 1, Author = "Matt", Review = "pretty good", MovieID = 4 //Title = "When Harry Met Sally" }, new Reviews { //ReviewId = 1, Author = "Ghost", Review = "Welp, I got Busted", MovieID = 5 //Title = "When Harry Met Sally" }, new Reviews { //ReviewId = 1, Author = "Ghost Two", Review = "I got busted yet again", MovieID = 6 //Title = "When Harry Met Sally" }, new Reviews { //ReviewId = 1, Author = "Rio", Review = "Bravo", MovieID = 7 //Title = "When Harry Met Sally" } ); 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-13", Price = 8.99M }, new Movie { Title = "Ghostbusters 2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comedy", Rating = "PG-13", Price = 9.99M }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Rating = "NR", Price = 3.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext(serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >())) { if (!context.Movies.Any()) { //if contains any data --- then we return --- we do not seed context.Movies.AddRange( new Movie { Title = "When Harry Met Sally", ReleaseDate = DateTime.Parse("1989-2-12"), Genre = "Romantic Comedy", Price = 7.99M, Rating = "PG", PosterName = "WhenHarryMetSallyPoster.jpg", }, new Movie { Title = "Ghostbusters ", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = "Comedy", Price = 8.99M, Rating = "GP", PosterName = "GhostBustersPoster.jpg" }, new Movie { Title = "Ghostbusters 2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comedy", Price = 9.99M, Rating = "GP", PosterName = "GhostBusters2Poster.jpg" }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Price = 3.99M, Rating = "R", PosterName = "RioBravoPoster.jpg" }, new Movie { Title = "Inglourious Basterds", ReleaseDate = DateTime.Parse("2009-08-21"), Genre = "War", Price = 5.00M, Rating = "R", PosterName = "InglouriousBasterdsPoster.jpg" }, new Movie { Title = "Mama", ReleaseDate = DateTime.Parse("2013-01-18"), Genre = "Horror", Price = 4.99M, Rating = "PG", PosterName = "MamaPoster.jpg" }, new Movie { Title = "Romeo + Juliet", ReleaseDate = DateTime.Parse("1996-11-01"), Genre = "Romance", Price = 6.29M, Rating = "PG", PosterName = "RomeoAndJulietPoster.jpg" }, new Movie { Title = "Jigsaw", ReleaseDate = DateTime.Parse("2017-10-27"), Genre = "Mystery", Price = 9.50M, Rating = "R", PosterName = "JigsawPoster.jpg" } ); } if (!context.Directors.Any()) { context.Directors.AddRange( new Director { Name = "Larz Thimoty Pal-ing" }, new Director { Name = "Michelle Espeleta" }, new Director { Name = "Kyla Samson" }, new Director { Name = "Vince \"The Terrible\" Repia" } ); } 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 }, new Movie { Title = "Ghostbusters ", ReleaseDate = DateTime.Parse("1984-3-13"), Genre = "Comedy", Price = 8.99M }, new Movie { Title = "Ghostbusters 2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comedy", Price = 9.99M }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Price = 3.99M }, new Movie { Title = "Deadpool", ReleaseDate = DateTime.Parse("2016-5-18"), Genre = "Action, Comedy", Price = 10.99M }, new Movie { Title = "Forest Gump", ReleaseDate = DateTime.Parse("1994-7-14"), Genre = "Comedy", Price = 5.99M } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MvcMovieContext( serviceProvider.GetRequiredService < DbContextOptions <MvcMovieContext> >())) { // Look for any movies. if (context.Product.Any()) { return; // DB has been seeded } context.Product.AddRange( new Product { p_code = "P00032", p_name = "썬더G", p_measure = 270, p_many = 23, p_location = "P-1", p_comprice = 100000, p_amount = "(개)", p_brandname = "롤러블레이드", p_customerprice = 150000 }, new Product { p_code = "P0001V", p_name = "썬더K", p_measure = 270, p_many = 3, p_location = "P-2", p_comprice = 100000, p_amount = "(개)", p_brandname = "롤러블레이드", p_customerprice = 150000 }, new Product { p_code = "P000RE", p_name = "썬더G", p_measure = 280, p_many = 43, p_location = "P-3", p_comprice = 100000, p_amount = "(개)", p_brandname = "롤러블레이드", p_customerprice = 150000 }, new Product { p_code = "P000J", p_name = "썬더H", p_measure = 230, p_many = 30, p_location = "P-4", p_comprice = 100000, p_amount = "(개)", p_brandname = "롤러블레이드", p_customerprice = 150000 } ); context.SaveChanges(); } }
public DeleteModel(MvcMovie.Models.MvcMovieContext context) { _context = context; }
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 RM", ReleaseDate = DateTime.Parse("2003-1-31"), Genre = "Comedy", Rating = "PG", Price = 4.99M, Image = "~/images/the-rm.jpg" }, new Movie { Title = "The Best Two Years", ReleaseDate = DateTime.Parse("2004-2-20"), Genre = "Comedy", Rating = "PG", Price = 9.99M, Image = "~/images/best-two-years.jpg" }, new Movie { Title = "The Singles Ward", ReleaseDate = DateTime.Parse("2002-1-30"), Genre = "Comedy", Rating = "PG", Price = 4.99M, Image = "~/images/singles-ward.jpg" }, new Movie { Title = "The Singles 2nd Ward", ReleaseDate = DateTime.Parse("2007-12-11"), Genre = "Comedy", Rating = "PG", Price = 4.99M, Image = "~/images/singles-2nd-ward.jpg" }, new Movie { Title = "Mobsters and Mormons", ReleaseDate = DateTime.Parse("2005-9-9"), Genre = "Comedy", Rating = "PG", Price = 4.99M, Image = "~/images/mobsters-and-mormons.jpg" } ); context.SaveChanges(); } }
public CreateModel(MvcMovie.Models.MvcMovieContext context) { Movie = new Movie(); _context = context; }
public static void EnsureCreated(IServiceProvider serviceProvider) { var context = new MvcMovieContext(serviceProvider.GetRequiredService <DbContextOptions <MvcMovieContext> >()); context.Database.EnsureCreated(); }
public EditModel(MvcMovie.Models.MvcMovieContext context) { _context = context; }
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 = "Tenet", ReleaseDate = DateTime.Parse("2020-8-12"), Genre = "Action", Price = 7.99M }, new Movie { Title = "Inception ", ReleaseDate = DateTime.Parse("2010-7-30"), Genre = "Comedy", Price = 10.99M }, new Movie { Title = "Ghostbusters 2", ReleaseDate = DateTime.Parse("1986-2-23"), Genre = "Comedy", Price = 9.99M }, new Movie { Title = "Rio Bravo", ReleaseDate = DateTime.Parse("1959-4-15"), Genre = "Western", Price = 3.99M }, new Movie { Title = "Harry Potter Deathly Hollow", ReleaseDate = DateTime.Parse("2010-11-11"), Genre = "Fantasy/Action", Price = 19.99M }, new Movie { Title = "Frozen", ReleaseDate = DateTime.Parse("2013-12-23"), Genre = "Musical", Price = 13.99M }, new Movie { Title = "Scary Movie", ReleaseDate = DateTime.Parse("2000-7-7"), Genre = "Comedy", Price = 10M }, new Movie { Title = "Work It", ReleaseDate = DateTime.Parse("2020-8-7"), Genre = "Comedy", Price = 5M } ); context.SaveChanges(); } }