public MainWindowViewModel() { Directors = _dALDirector.AllDirectors(); Distributors = _dALDistributor.AllDistributors(); Actors = _dALActor.AllActors(); Genres = _dALGenre.AllGenres(); Movies = _dALMovie.AllMovies(); Cinemas = _dALCinema.AllCinemas(); Places = _dALPlace.AllPlaces(); }
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(); } }
// GET: api/Movie public List <Movie> GetMovies() { return(_dALMovie.AllMovies()); }