Esempio n. 1
0
        public IActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            Movie movie = objMovie.GetMovieData(id);

            ViewBag.ActorsList    = objMovie.GetAllActors().ToList();
            ViewBag.ProducersList = objMovie.GetAllProducers().ToList();
            if (movie == null)
            {
                return(NotFound());
            }
            return(View(movie));
        }
Esempio n. 2
0
        public void GetMovieByIdFromDatabase()
        {
            var options = new DbContextOptionsBuilder <ApplicationDBContext>()
                          .UseNpgsql("User ID=postgres;Password=123;Host=localhost;Port=5432;Database=reactdb;Pooling=true;")
                          .Options;

            using (var context = new ApplicationDBContext(options))
            {
                var service = new MovieDataAccessLayer(context);
                service.GetMovieData(3);
            }

            using (var context = new ApplicationDBContext(options))
            {
                Assert.AreEqual("Ghostbusters 2", context.Movie.Find(3).Title);
            }
        }