private void AddActorExecute()
        {
            try
            {
                int selectedActorId = _dALActor.AllActors().ElementAt(SelectedActor).Id;
                var actor           = _dALActor.GetActorById(selectedActorId);

                if (!_movie.Actors.ToList().Exists(a => a.Id == actor.Id))
                {
                    _dALActor.AddActsProcedure(actor.Id, _movie.Id);
                }
                Actor = null;
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #2
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();
            }
        }
Пример #3
0
        public void AddActorsForMovie(int actorId, int movieId)
        {
            DALActor dALActor = new DALActor();

            dALActor.AddActsProcedure(actorId, movieId);
        }