コード例 #1
0
        public HomePageViewModel()
        {
            facade        = Façade.Instance();
            Movies        = facade.AllMovie();
            GenreMovie    = facade.AllGenre();
            Comment       = new Commentaire_Note();
            MovieSelected = null;
            Search        = "";
            Genre         = "";

            NameCollection = new List <string>
            {
                "Action",
                "Comédie",
                "Horreur"
            };

            MyButtonAddMovieCommand     = new RelayCommand(MyButtonAddMovieCommandExecute, MyButtonAddMovieCanExecute);
            MyAddMovieCommand           = new RelayCommand(MyAddMovieCommandExecute, MyAddMovieCanExecute);
            MyDeleteMovieCommand        = new RelayCommand(MyDeleteMovieCommandExecute, MyDeleteMovieCanExecute);
            MySearchCommand             = new RelayCommand(MySearchCommandExecute, MySearchCanExecute);
            MyButtonCommentMovieCommand = new RelayCommand(MyButtonCommentMovieCommandExecute, MyButtonCommentMovieCanExecute);
            MyCommentMovieCommand       = new RelayCommand(MyCommentMovieCommandExecute, MyCommentMovieCanExecute);
            MyButtonAllCommentCommand   = new RelayCommand(MyButtonAllCommentMovieCommandExecute, MyButtonAllCommentMovieCanExecute);
        }
コード例 #2
0
        public void MyAddMovieCommandExecute()
        {
            if (MovieSelected.Titre != null && MovieSelected.Genre != null && MovieSelected.Resume != null)
            {
                if (movieSelected.Id > 0 && facade.ById(movieSelected.Id) != null)
                {
                    facade.UpdateMovie(movieSelected);
                }
                else
                {
                    facade.AddMovie(MovieSelected);
                }

                MovieSelected = null;
                Movies        = facade.AllMovie();
                GenreMovie    = facade.AllGenre();
                addMovieWindow.Close();
            }
        }