Пример #1
0
        private static void DeleteMovie()
        {
            MovieBusiness movieBusiness = new MovieBusiness(_repository);
            List <Movie>  movies;
            string        message;

            using (movieBusiness)
            {
                movies = movieBusiness.SelectAll();
                Movie movie = movieBusiness.SelectById(ConsoleView.GetMovieID(movieBusiness.SortByAscendingID()));

                if (movie != null && movie.ID != -2)
                {
                    if (ConsoleView.ValidateEdit(movie, "Delete", "Movie " + movie.ID))
                    {
                        movieBusiness.Delete(movie.ID);
                        ConsoleView.DisplayReset();

                        message = String.Format("Movie {0}: {1} has been deleted.", movie.ID, movie.Title);

                        ConsoleView.DisplayMessage(message);
                        ConsoleView.DisplayContinuePrompt();
                    }
                }
            }
        }
Пример #2
0
        private static void ListAllMovies()
        {
            MovieBusiness movieBusiness = new MovieBusiness(_repository);
            List <Movie>  movies;

            using (movieBusiness)
            {
                movies = movieBusiness.SelectAll();
                ConsoleView.BrowseAllMovies(movieBusiness.SortByAscendingID(), false, "");
                //ConsoleView.DisplayContinuePrompt();
            }
        }
Пример #3
0
        private static void UpdateMovie()
        {
            MovieBusiness movieBusiness = new MovieBusiness(_repository);
            List <Movie>  movies;
            Movie         movie;
            int           movieID;

            using (movieBusiness)
            {
                movies  = movieBusiness.SelectAll();
                movieID = ConsoleView.GetMovieID(movieBusiness.SortByAscendingID());
                movie   = movieBusiness.SelectById(movieID);
                movie   = ConsoleView.UpdateMovie(movie);
                if (movie != null)
                {
                    movieBusiness.Update(movie);
                }
            }
        }
Пример #4
0
        private static void DisplayMovieDetail()
        {
            MovieBusiness movieBusiness = new MovieBusiness(_repository);
            List <Movie>  movies;
            Movie         movie;
            int           movieID;

            using (movieBusiness)
            {
                movies  = movieBusiness.SelectAll();
                movieID = ConsoleView.GetMovieID(movieBusiness.SortByAscendingID());
                if (movieID != -2)
                {
                    movie = movieBusiness.SelectById(movieID);
                    ConsoleView.DisplayMovie(movie);
                    ConsoleView.DisplayContinuePrompt();
                }
            }
        }