Exemplo n.º 1
0
        private void AddMovieExecute()
        {
            if (!string.IsNullOrEmpty(Movie.Title))
            {
                Movie newMovie = new Movie
                {
                    Duration       = Movie.Duration,
                    Title          = Movie.Title,
                    Desctiprion    = Movie.Desctiprion,
                    Distributor_Id = _dALDistributor.AllDistributors().ElementAt(SelectedDistributor).Id,
                    Director_Id    = _dALDirector.AllDirectors().ElementAt(SelectedDirector).Id,
                    MetaScore      = 0,
                    Festivals      = new List <Festival>(),
                    Reviews        = new List <Review>(),
                    Actors         = new List <Actor>(),
                    Genres         = new List <Genre>(),
                    ShowsMovies    = new List <ShowsMovie>(),
                    Deleted        = false
                };

                _dALMovie.AddMovie(newMovie);
                var lastAddedMovie = _dALMovie.AllMovies().LastOrDefault();

                _movieActors.ForEach(a =>
                {
                    _dALActor.AddActsProcedure(a.Id, lastAddedMovie.Id);
                });

                _movieGenres.ForEach(g =>
                {
                    _dALGenre.AddBelongToGenreProcedure(g.Id, lastAddedMovie.Id);
                });

                _movieFestivals.ForEach(f => {
                    _dALFestival.AddMovieFestivalProcedure(f.Id, lastAddedMovie.Id);
                });

                _movieFestivalAward.ForEach(a => {
                    a.MovieFestival_Movie_Id = lastAddedMovie.Id;
                    _dALAward.AddMovieFestivalAward(a);
                });

                _showsMovie.ForEach(a =>
                {
                    a.Movie_Id = lastAddedMovie.Id;
                    _dALCinema.AddShowsMovie(a);
                });

                actor_window.Close();
            }
        }
        private void UpdateMovieExecute()
        {
            try
            {
                _movieActors.ForEach(a =>
                {
                    _dALActor.AddActsProcedure(a.Id, _movie.Id);
                });

                _movieGenres.ForEach(g =>
                {
                    _dALGenre.AddBelongToGenreProcedure(g.Id, _movie.Id);
                });

                _movieFestivals.ForEach(f => {
                    _dALFestival.AddMovieFestivalProcedure(f.Id, _movie.Id);
                });

                _movieFestivalAward.ForEach(a => {
                    a.MovieFestival_Movie_Id = _movie.Id;
                    _dALAward.AddMovieFestivalAward(a);
                });

                _showsMovie.ForEach(a =>
                {
                    a.Movie_Id = _movie.Id;
                    _dALCinema.AddShowsMovie(a);
                });

                _dALHelper.UpdateMovie(_movie);

                window.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 3
0
        public void AddFestivalsForMovie(int festivalId, int movieId)
        {
            DALFestival dALFestival = new DALFestival();

            dALFestival.AddMovieFestivalProcedure(festivalId, movieId);
        }