Пример #1
0
 public Role(Movie movie, Actor actor, String role)
 {
     this.movie = movie;
     this.actor = actor;
     this.role  = role;
     movie.Add(this);
     actor.Add(this);
 }
Пример #2
0
        private async Task AddActorsToMovie(MovieDTO movieDTO, Movie movie)
        {
            foreach (int actorId in movieDTO.MovieActorsId)
            {
                Person actor = await _context.People.FindAsync(actorId);

                MoviePerson moviePerson = new MoviePerson(movie, actor);
                movie.Add(moviePerson);
            }
        }
Пример #3
0
        private async Task AddProducersToMovie(MovieDTO movieDTO, Movie movie)
        {
            foreach (int producerId in movieDTO.MovieProducersId)
            {
                Producer producer = await _context.Producers.FindAsync(producerId);

                MovieProducer movieProducer = new MovieProducer(movie, producer);
                movie.Add(movieProducer);
            }
        }
Пример #4
0
        public void Execute()
        {
            _ratedMovie.Add(_rating);
            _ratingAuthor.Give(_rating, _stars);

            _criticsHavingRated.RecalculateRatingWeights();
            _allMovies.UpdateAverageRatings();

            _unitOfWork.Conclude();

            _ratingAuthor.ShowRatingWeightOn(_output);
            _ratedMovie.ShowAverageRatingOn(_output);
        }
Пример #5
0
        public void GenerateMovie()
        {
            Movie.Add(new Movies()
            {
                Id          = Guid.NewGuid(),
                Mid         = 101,
                Title       = "John Wick",
                ReleaseDate = new DateTime(2020, 3, 10, 0, 0, 0)
            });

            Movie.Add(new Movies()
            {
                Id          = Guid.NewGuid(),
                Mid         = 102,
                Title       = "Ashfall",
                ReleaseDate = new DateTime(2020, 3, 10, 0, 0, 0)
            });
        }
Пример #6
0
 public void GenerateMovieData()
 {
     Movie.Add(new Movie()
     {
         MovieId = 101, MovieTitle = "The Justice League", ReleaseDate = new DateTime(2020, 03, 01), Status = Status.NowShowing
     });
     Movie.Add(new Movie()
     {
         MovieId = 102, MovieTitle = "The Matrix", ReleaseDate = new DateTime(2020, 03, 02), Status = Status.NowShowing
     });
     Movie.Add(new Movie()
     {
         MovieId = 103, MovieTitle = "The Avengers", ReleaseDate = new DateTime(2020, 03, 06), Status = Status.ComingSoon
     });
     Movie.Add(new Movie()
     {
         MovieId = 104, MovieTitle = "Lord of the Ring", ReleaseDate = new DateTime(2020, 03, 10), Status = Status.ComingSoon
     });
 }
Пример #7
0
        static void Main(string[] args)
        {
            int choice = 0;

            Console.WriteLine("Hello World!");
            Console.WriteLine("1. Add Actor");
            Console.WriteLine("2. Add Movie");
            Console.WriteLine("3. Delete Actor");
            Console.WriteLine("4. Delete Movie");
            Console.Write("Enter Your Choice");
            choice = Convert.ToInt32(Console.ReadLine());
            Movie movie = new Movie();
            Actor ac    = new Actor();

            do
            {
                switch (choice)
                {
                case 1:
                    ac.Add();
                    break;

                case 2:
                    movie.Add();
                    break;

                case 3:
                    ac.Delete();
                    break;

                case 4:
                    movie.Delete();
                    break;

                case 5:

                    break;
                }
                Console.WriteLine("Enter Your Choice:");
                choice = Convert.ToInt32(Console.ReadLine());
            } while (choice != 0);
        }
Пример #8
0
        public void GenerateMovie()
        {
            Movie.Add(new Movies()
            {
                Id                = Guid.NewGuid(),
                Mid               = 101,
                Title             = "Bruce Almighty",
                ReleaseDate       = new DateTime(2020, 3, 10, 0, 0, 0),
                MovieAvailability = true
            });

            Movie.Add(new Movies()
            {
                Id                = Guid.NewGuid(),
                Mid               = 102,
                Title             = "Ashfall",
                ReleaseDate       = new DateTime(2020, 3, 15, 0, 0, 0),
                MovieAvailability = true
            });

            Movie.Add(new Movies()
            {
                Id                = Guid.NewGuid(),
                Mid               = 103,
                Title             = "Train to Busan",
                ReleaseDate       = new DateTime(2020, 3, 30, 0, 0, 0),
                MovieAvailability = false
            });

            Movie.Add(new Movies()
            {
                Id                = Guid.NewGuid(),
                Mid               = 104,
                Title             = "Tom & Jerry",
                ReleaseDate       = new DateTime(2020, 3, 26, 0, 0, 0),
                MovieAvailability = true
            });
        }
Пример #9
0
        private void btnAddMovie_Click(object sender, EventArgs e)
        {
            //Step 1: Get the values in each textbox
            M.Title       = txtbxTitle.Text;
            M.ReleaseYear = int.Parse(txtbxReleaseYr.Text);
            M.Genre       = cmbxGenre.Text;
            M.Director    = txtbxDirector.Text;
            M.Producer    = txtbxProducer.Text;
            M.Writer      = txtbxWriter.Text;
            M.Rating      = cmbxRating.Text;
            //Step 2: Add data into DB using the methods in the Movie Class
            bool isAdded = M.Add(M);

            if (isAdded == true)
            {
                MessageBox.Show("Movie Added!");
                LoadDataGrid();
            }
            else
            {
                MessageBox.Show("Failed to Add Movie. Try Again...");
                Clear();
            }
        }
Пример #10
0
        public void FillDbWithData()
        {
            Country country1 = new Country {
                Name = "Poland"
            };
            Country country2 = new Country {
                Name = "Vietnam"
            };

            Person director1 = new Person
            {
                FirstName   = "Joe",
                LastName    = "Doe",
                Type        = TypeOfPeople.DIRECTOR,
                DateOfBirth = DateTime.Now,
                DateOfDeath = DateTime.Now,
                Sex         = TypeOfSex.MALE,
                Country     = country1
            };

            Person actor1 = new Person
            {
                FirstName   = "Stefa",
                LastName    = "Rychu",
                Type        = TypeOfPeople.ACTOR,
                DateOfBirth = DateTime.Now,
                DateOfDeath = DateTime.Now,
                Sex         = TypeOfSex.FEMALE,
                Country     = country2
            };

            Person actor2 = new Person
            {
                FirstName   = "Rychu",
                LastName    = "Peja",
                Type        = TypeOfPeople.ACTOR,
                DateOfBirth = DateTime.Now,
                DateOfDeath = DateTime.Now,
                Sex         = TypeOfSex.MALE,
                Country     = country1
            };

            Movie movie1 = new Movie
            {
                Title    = "Snoop doog",
                Director = director1,
                Genre    = TypesOfGenre.COMEDY,
                Length   = 127,
                Year     = DateTime.Now,
                Country  = country2
            };

            Producer producer1 = new Producer
            {
                CompanyName           = "Test Company",
                YearEstablished       = DateTime.Now,
                EstimatedCompanyValue = 40000000,
                Country = country1,
            };

            MoviePerson   moviePerson1   = new MoviePerson(movie1, actor1);
            MoviePerson   moviePerson2   = new MoviePerson(movie1, actor2);
            MovieProducer movieProducer1 = new MovieProducer(movie1, producer1);

            movie1.Add(moviePerson1);
            movie1.Add(moviePerson2);
            movie1.Add(movieProducer1);

            _context.Movies.Add(movie1);
            _context.SaveChanges();
        }
Пример #11
0
 public void Add(Movie movie)
 {
     movies.Add(movie);
     movie.Add(this);
 }
Пример #12
0
        public void Menu()
        {
            int selection = 0;
            string option;

            //view menu

            do
            {
                format();
                selection = Int32.Parse(Console.ReadLine());
                switch (selection)
                {
                    case 1:

                    do
                    {
                        Questions();
                        selection = Int32.Parse(Console.ReadLine());

                        if (selection == 1)
                        {
                            Movie readMovies = new Movie();
                        }
                        
                        do
                        {
                            readMovies.Read();
                            Console.WriteLine("Do you want to view more movies? (Y/N)");
                            option = Console.ReadLine().ToUpper();
                        }
                         while (option == "Y");
                    }

                    else if (Menu == 2)
                    {
                       Movie addMovie = new Movie(); 
                       do
                       {
                           addMovie.Add();
                           System.Console.WriteLine("Do you want to add another movie? (Y/N)");
                           option = Console.ReadLine().ToUpper();
                       } 
                       while (option == "Y");
                    }
                    else
                    {
                        Console.WriteLine("Return to menu...");
                    }
                    while (selection != 3);
                        break;

                    case 2: 
                    
                    do
                    {
                        Questions();
                        selection = Int32.Parse(Console.ReadLine());

                        if (selection == 2)
                        {
                            Series readSeries = new Series();
                        }
                        
                        do
                        {
                            readSeries.Read();
                            Console.WriteLine("Do you want to view series? (Y/N)");
                            option = Console.ReadLine().ToUpper();
                        }
                         while (option == "Y");
                    }

                    else if (Menu == 2)
                    {
                       Series addMovie = new Series(); 
                       do
                       {
                           addSeries.Add();
                           System.Console.WriteLine("Do you want to add another series? (Y/N)");
                           option = Console.ReadLine().ToUpper();
                       } 
                       while (option == "Y");
                    }
                    else
                    {
                        Console.WriteLine("Return to menu...");
                    }
                    while (selection != 3);
                        break; 

                    case 3:

                    do
                    {
                        Questions();
                        selection = Int32.Parse(Console.ReadLine());

                        if (selection == 3)
                        {
                            Video readVideos = new Video();
                        }
                        
                        do
                        {
                            readVideos.Read();
                            Console.WriteLine("Do you want to view videos? (Y/N)");
                            option = Console.ReadLine().ToUpper();
                        }
                         while (option == "Y");
                    }

                    else if (Menu == 3)
                    {
                       Video addVideos = new Videos(); 
                       do
                       {
                           addVideos.Add();
                           System.Console.WriteLine("Do you want to add another video? (Y/N)");
                           option = Console.ReadLine().ToUpper();
                       } 
                       while (option == "Y");
                    }
                    else
                    {
                        Console.WriteLine("Return to menu...");
                    }
                    while (selection != 3);
                    break;      
                }
                while (selection != 4);
                }
                
            }    
Пример #13
0
        public void FillDbWithData()
        {
            Country country1 = new Country {
                Name = "Poland"
            };
            Country country2 = new Country {
                Name = "Vietnam"
            };
            Country country3 = new Country {
                Name = "France"
            };

            Person director1 = new Person
            {
                FirstName   = "Joe",
                LastName    = "Doe",
                Type        = TypeOfPeople.DIRECTOR,
                DateOfBirth = DateTime.Now,
                DateOfDeath = DateTime.Now,
                Sex         = TypeOfSex.MALE,
                Country     = country1
            };

            Person director2 = new Person
            {
                FirstName   = "Coco",
                LastName    = "Jambo",
                Type        = TypeOfPeople.DIRECTOR,
                DateOfBirth = DateTime.Now,
                DateOfDeath = DateTime.Now,
                Sex         = TypeOfSex.MALE,
                Country     = country3
            };

            Person actor1 = new Person
            {
                FirstName   = "Stefa",
                LastName    = "Rychu",
                Type        = TypeOfPeople.ACTOR,
                DateOfBirth = DateTime.Now,
                DateOfDeath = DateTime.Now,
                Sex         = TypeOfSex.FEMALE,
                Country     = country2
            };

            Person actor2 = new Person
            {
                FirstName   = "Rychu",
                LastName    = "Peja",
                Type        = TypeOfPeople.ACTOR,
                DateOfBirth = DateTime.Now,
                DateOfDeath = DateTime.Now,
                Sex         = TypeOfSex.MALE,
                Country     = country1
            };

            Person actor3 = new Person
            {
                FirstName   = "Seba",
                LastName    = "Przykuc",
                Type        = TypeOfPeople.ACTOR,
                DateOfBirth = DateTime.Now,
                DateOfDeath = DateTime.Now,
                Sex         = TypeOfSex.MALE,
                Country     = country3
            };

            Person actor4 = new Person
            {
                FirstName   = "Karyna",
                LastName    = "Bombelek",
                Type        = TypeOfPeople.ACTOR,
                DateOfBirth = DateTime.Now,
                DateOfDeath = DateTime.Now,
                Sex         = TypeOfSex.MALE,
                Country     = country3
            };

            Movie movie1 = new Movie
            {
                Title    = "Snoop doog",
                Director = director1,
                Genre    = TypesOfGenre.COMEDY,
                Length   = 127,
                Year     = DateTime.Now,
                Country  = country2
            };

            Movie movie2 = new Movie
            {
                Title    = "Kac Krakow",
                Director = director2,
                Genre    = TypesOfGenre.DRAMA,
                Length   = 101,
                Year     = DateTime.Now,
                Country  = country1
            };

            Movie movie3 = new Movie
            {
                Title    = "Zycie ostre jak maczeta",
                Director = director2,
                Genre    = TypesOfGenre.FANTASY,
                Length   = 101,
                Year     = DateTime.Now,
                Country  = country1
            };

            Producer producer1 = new Producer
            {
                CompanyName           = "Test Company",
                YearEstablished       = DateTime.Now,
                EstimatedCompanyValue = 40000000,
                Country = country1,
            };

            Producer producer2 = new Producer
            {
                CompanyName           = "Januszex POL",
                YearEstablished       = DateTime.Now,
                EstimatedCompanyValue = 999999999999,
                Country = country2,
            };

            MoviePerson   movie1Person1   = new MoviePerson(movie1, actor1);
            MoviePerson   movie1Person2   = new MoviePerson(movie1, actor2);
            MoviePerson   movie2Person1   = new MoviePerson(movie2, actor2);
            MoviePerson   movie2Person2   = new MoviePerson(movie2, actor4);
            MoviePerson   movie3Person1   = new MoviePerson(movie3, actor3);
            MoviePerson   movie3Person2   = new MoviePerson(movie3, actor4);
            MovieProducer movie1Producer1 = new MovieProducer(movie1, producer1);
            MovieProducer movie2Producer1 = new MovieProducer(movie2, producer2);
            MovieProducer movie2Producer2 = new MovieProducer(movie2, producer1);
            MovieProducer movie3Producer1 = new MovieProducer(movie3, producer2);

            movie1.Add(movie1Person1);
            movie1.Add(movie1Person2);
            movie1.Add(movie1Producer1);

            movie2.Add(movie2Person1);
            movie2.Add(movie2Person2);
            movie2.Add(movie2Producer1);
            movie2.Add(movie2Producer2);


            movie3.Add(movie3Person1);
            movie3.Add(movie3Person2);
            movie3.Add(movie3Producer1);

            _context.Movies.Add(movie1);
            _context.Movies.Add(movie2);
            _context.Movies.Add(movie3);
            _context.SaveChanges();
        }