private void AddGenreExecute() { try { int selectedGenreId = _dALGenre.AllGenres().ElementAt(SelectedGenre).Id; var genre = _dALGenre.GetGenreById(selectedGenreId); if (!_movie.Genres.ToList().Exists(g => g.Id == genre.Id)) { _dALGenre.AddBelongToGenreProcedure(genre.Id, _movie.Id); } Genre = null; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
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(); } }
public void AddGenresForMovie(int genreId, int movieId) { DALGenre dALGenre = new DALGenre(); dALGenre.AddBelongToGenreProcedure(genreId, movieId); }