Beispiel #1
0
 public APITestController(MvcMovieContext context)
 {
     _context = context;
 }
 public MoviesController(MvcMovieContext context, IWebHostEnvironment hostEnvironment)
 {
     _context = context;
     this._hostEnvironment = hostEnvironment;
 }
Beispiel #3
0
        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("1989-2-12"),
                    Genre       = "Romantic Comedy",
                    Rating      = "R",
                    Price       = 7.99M
                },

                    new Movie
                {
                    Title       = "Ghostbusters ",
                    ReleaseDate = DateTime.Parse("1984-3-13"),
                    Genre       = "Comedy",
                    Rating      = "R",
                    Price       = 8.99M
                },

                    new Movie
                {
                    Title       = "Ghostbusters 2",
                    ReleaseDate = DateTime.Parse("1986-2-23"),
                    Genre       = "Comedy",
                    Rating      = "R",
                    Price       = 9.99M
                },

                    new Movie
                {
                    Title       = "Rio Bravo",
                    ReleaseDate = DateTime.Parse("1959-4-15"),
                    Genre       = "Western",
                    Rating      = "R",
                    Price       = 3.99M
                }

                    );

/*
 *              for (int i = 0; i < 10000; i++)
 *              {
 *                  context.Movie.Add(new Movie {
 *                      Title = $"TEST{i}",
 *                      ReleaseDate = DateTime.Parse("1959-4-15"),
 *                      Genre = "Western",
 *                      Rating = "R",
 *                      Price = 3.99M
 *                  });
 *              }
 */
                context.SaveChanges();
            }
        }
 /// <summary>
 /// The constructor provides the shopping cart with access to the movie database.
 /// </summary>
 /// <param name="context"></param>
 public CartController(MvcMovieContext context)
 {
     _context = context;
 }
 public UploadFilesController(MvcMovieContext context)
 {
     _context = context;
 }
Beispiel #6
0
 public EventosController(MvcMovieContext context)
 {
     _context = context;
 }
Beispiel #7
0
 public ReviewController(MvcMovieContext context)
 {
     _context = context;
 }
 public LanguageController(MvcMovieContext context)
 {
     _context = context;
 }
Beispiel #9
0
 public MoviesController(MvcMovieContext context, IDistributedCache distributedCache, IHostEnvironment env)
 {
     _context          = context;
     _distributedCache = distributedCache;
     _env = env;
 }
 public SpeakersController(MvcMovieContext context)
 {
     _context = context;
 }
 public MoviesController(MvcMovieContext _context)
 {
     this._context = _context;
 }
Beispiel #12
0
 public WatchlistRepo(MvcMovieContext context)
 {
     _context = context;
 }
Beispiel #13
0
 public StudentsController(MvcMovieContext context)
 {
     _context = context;
 }
Beispiel #14
0
        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       = "Comédia Romântica",
                    Rating      = "R",
                    Price       = 7.99M
                },

                    new Movie
                {
                    Title       = "Ghostbusters ",
                    ReleaseDate = DateTime.Parse("1984-3-13"),
                    Genre       = "Comédia",
                    Rating      = "R",
                    Price       = 8.99M
                },

                    new Movie
                {
                    Title       = "Ghostbusters 2",
                    ReleaseDate = DateTime.Parse("1986-2-23"),
                    Genre       = "Comédia",
                    Rating      = "R",
                    Price       = 9.99M
                },

                    new Movie
                {
                    Title       = "Rio Bravo",
                    ReleaseDate = DateTime.Parse("1959-4-15"),
                    Genre       = "Ocidental",
                    Rating      = "R",
                    Price       = 3.99M
                },
                    new Movie
                {
                    Title       = "Velozes e Furiosos 9",
                    ReleaseDate = DateTime.Parse("2099-1-01"),
                    Genre       = "Ocidental",
                    Rating      = "R",
                    Price       = 99.99M
                },
                    new Movie
                {
                    Title       = "Velozes e Furiosos 100",
                    ReleaseDate = DateTime.Parse("3099-1-01"),
                    Genre       = "Ocidental",
                    Rating      = "R",
                    Price       = 99.98M
                }
                    );
                context.SaveChanges();
            }
        }
Beispiel #15
0
 public MoviesController(MvcMovieContext context, IMovieService service)
 {
     _context     = context;
     this.service = service;
 }
 public DiretorsController(MvcMovieContext context)
 {
     _context = context;
 }
 public MoviesController(IHostingEnvironment hostingEnvironment, MvcMovieContext context)
 {
     _context            = context;
     _hostingEnvironment = hostingEnvironment;
 }
Beispiel #18
0
 public APIMovies(MvcMovieContext context)
 {
     _context = context;
 }
Beispiel #19
0
 public BookController(MvcMovieContext context)
 {
     _context = context;
 }
Beispiel #20
0
        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
                }



                #region snippet1

                context.Movie.AddRange(

                    new Movie

                {
                    Title = "When Harry Met Sally",

                    ReleaseDate = DateTime.Parse("1989-2-12"),

                    Genre = "Romantic Comedy",

                    Price = 7.99M
                },

                    #endregion



                    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 DeleteModel(MvcMovieContext context)
 {
     _context = context;
 }
 public ProductTypeController(MvcMovieContext context)
 {
     _context = context;
 }
Beispiel #23
0
 public MoviesController(MvcMovieContext context,
                         IHostingEnvironment hostingEnvironment)
 {
     _context = context;
     this.hostingEnvironment = hostingEnvironment;
 }
Beispiel #24
0
 public DirectorsController(MvcMovieContext context, IDirectorService directorService, MovieDbContext db)
 {
     _context         = context;
     _directorService = directorService;
     _db = db;
 }
Beispiel #25
0
 public CamionesController(MvcMovieContext context)
 {
     modelo = new Modelo(context);
 }
Beispiel #26
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ApplicationDbContext appContext, MvcMovieContext movieContext)
        {
            //movieContext.Database.Migrate();
            appContext.Database.Migrate();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });
        }
Beispiel #27
0
 public ToDoController(MvcMovieContext context)
 {
     _context = context;
 }
 public HelloWorldController(MvcMovieContext context)
 {
     _context = context;
 }
Beispiel #29
0
 public MoviesController(MvcMovieContext context)
 {
     _context = context;
 }
 public MovieService(MvcMovieContext db)
 {
     _db = db;
 }