Exemplo n.º 1
0
        private MediaType _medium;   //Backing Field for medium

        //Constructor
        // Precondition:  None
        // Postcondition: A library movie is instantiated and given a library itme attributes in addition to
        //                a director, medium, and rating.
        public LibraryMovie(string theTitle, string thePublisher, int theCopyrightYear, int theLoanPeriod,
                            string theCallNumber, double theDuration, string theDirector, MediaType theMedium, MPAARatings theRating)
            : base(theTitle, thePublisher, theCopyrightYear, theLoanPeriod, theCallNumber, theDuration)
        {
            Director = theDirector;
            Rating   = theRating;
        }
Exemplo n.º 2
0
 // Parameter constructor
 public LibraryMovie(string theTitle, string thePublisher, int theCopyrightYear, string theCallNumber, int theLoanPeriod, double theDuration, string theDirector, MediaType medium, MPAARatings rating) : base(theTitle, thePublisher, theCopyrightYear, theCallNumber, theLoanPeriod, theDuration)
 {
     // validate via properties
     Director = theDirector;
     Medium   = medium;
     Rating   = rating;
 }
 /// <summary>
 /// Gets the search results for display on the page
 /// </summary>
 public void OnGet()
 {
     //MPAARatings = Request.Query["MPAARatings"];
     //SearchTerms = Request.Query["SearchTerms"];
     //Genres = Request.Query["Genres"];
     //Movies = MovieDatabase.Search(SearchTerms);
     //Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
     //Movies = MovieDatabase.FilterByRottenTomatoes(Movies, TomMin, TomMax);
     //Movies = MovieDatabase.FilterByGenre(Movies, Genres);
     //Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
     Movies = MovieDatabase.All;
     // Search movie titles for the SearchTerms
     if (SearchTerms != null)
     {
         Movies = Movies.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.InvariantCultureIgnoreCase));
     }
     // Filter by MPAA Rating
     if (MPAARatings != null && MPAARatings.Length != 0)
     {
         Movies = Movies.Where(movie =>
                               movie.MPAARating != null &&
                               MPAARatings.Contains(movie.MPAARating)
                               );
     }
     if (TomMax != null || TomMin != null)
     {
         Movies = Movies.Where(movie => movie.RottenTomatoesRating != null &&
                               (movie.RottenTomatoesRating <TomMax && movie.RottenTomatoesRating> TomMin));
     }
     if (IMDBMax != null || IMDBMin != null)
     {
         Movies = Movies.Where(movie => movie.IMDBRating != null &&
                               (movie.IMDBRating <IMDBMax && movie.IMDBRating> IMDBMin));
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the search results for display on the page
 /// </summary>
 public void OnGet(double?IMDBMin, double?IMDBMax)
 {
     /*
      *          Movies = MovieDatabase.All;
      *
      *          SearchTerms = Request.Query["SearchTerms"];
      *          MPAARatings = Request.Query["MPAARatings"];
      *          Genres = Request.Query["Genres"];
      *
      *          this.IMDBMin = IMDBMin;
      *          this.IMDBMax = IMDBMax;
      */
     Movies = MovieDatabase.All;
     // Search movie title for the SearchTerms
     if (SearchTerms != null)
     {
         Movies = Movies.Where(movie => { return(movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase)); });
     }
     if (MPAARatings != null && MPAARatings.Length != 0)
     {
         Movies = Movies.Where(movie => movie.MPAARating != null && MPAARatings.Contains(movie.MPAARating));
     }
     if (Genres != null && Genres.Length != 0)
     {
         Movies = Movies.Where(movie => movie.MajorGenre != null && Genres.Contains(movie.MajorGenre));
     }
 }
        public void OnGet(double?IMDBMin, double?IMDBMax, double?RTMin, double?RTMax)
        {
            /*
             * this.IMDBMin = IMDBMin;
             * this.IMDBMax = IMDBMax;
             * Movies = MovieDatabase.Search(SearchTerms);
             * Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
             * Movies = MovieDatabase.FilterByGenre(Movies, Genres);
             * Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
             * Movies = MovieDatabase.FilterByRTRating(Movies, RTMin, RTMax);
             */
            Movies = MovieDatabase.All;
            if (SearchTerms != null)
            {
                Movies = Movies.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase));
            }
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MPAARating != null &&
                                      MPAARatings.Contains(movie.MPAARating)
                                      );
            }

            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MajorGenre != null &&
                                      Genres.Contains(movie.MajorGenre)
                                      );
            }
        }
Exemplo n.º 6
0
 public LibraryMovie(string title, string publisher, int copyrightYr, int loanPd,
                     string callNum, double duration, string director, MediaType medium,
                     MPAARatings rating)
     : base(title, publisher, copyrightYr, loanPd,
            callNum, duration)
 {
     Director = director;
 }
        /// <summary>
        /// Gets the search results for display on the page
        /// </summary>
        public void OnGet(double?IMDBMin, double?IMDBMax, double?RTMin, double?RTMax)
        {
            //this.IMDBMin = IMDBMin;
            //this.IMDBMax = IMDBMax;
            //this.RTMax = RTMax;
            //this.RTMin = RTMin;
            //SearchTerms = Request.Query["SearchTerms"];
            //MPAARatings = Request.Query["MPAARatings"];
            //Genres = Request.Query["Genres"];
            //Movies = MovieDatabase.Search(SearchTerms);
            //Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
            //Movies = MovieDatabase.FilterByGenres(Movies, Genres);
            //Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
            //Movies = MovieDatabase.FilterByRTRating(Movies, RTMin, RTMax);

            Movies = MovieDatabase.All;
            if (SearchTerms != null)
            {
                Movies.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase));
                //Movies = from movie in Movies
                //         where movie.Title.Contains(SearchTerms, StringComparison.OrdinalIgnoreCase)
                //         select movie;
            }

            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie => movie.MPAARating != null && MPAARatings.Contains(movie.MPAARating));
            }
            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie => movie.MajorGenre != null && Genres.Contains(movie.MajorGenre));
            }
            if (IMDBMin == null && IMDBMax != null)
            {
                Movies = Movies.Where(movie => movie.IMDBRating <= IMDBMax);
            }
            if (IMDBMax == null && IMDBMin != null)
            {
                Movies = Movies.Where(movie => movie.IMDBRating >= IMDBMin);
            }
            if (IMDBMax != null && IMDBMin != null)
            {
                Movies = Movies.Where(movie => movie.IMDBRating >= IMDBMin && movie.IMDBRating <= IMDBMax);
            }
            if (RTMin == null && RTMin != null)
            {
                Movies = Movies.Where(movie => movie.RottenTomatoesRating <= RTMax);
            }

            if (RTMax == null && RTMin != null)
            {
                Movies = Movies.Where(movie => movie.RottenTomatoesRating >= RTMin);
            }
            if (RTMax != null && RTMin != null)
            {
                Movies = Movies.Where(movie => movie.RottenTomatoesRating >= RTMin && movie.RottenTomatoesRating <= RTMax);
            }
        }
Exemplo n.º 8
0
        private MediaType _movieMedium; // The movie's medium

        #endregion Fields

        #region Constructors

        // Precondition:  None
        // Postcondition: The movie has been initialized with the specified
        //                values for title, publisher, copyright year, loan period,
        //                call number, duration, director, medium, and rating. The
        //                item is not checked out.
        public LibraryMovie(String theTitle, String thePublisher, int theCopyrightYear,
            int theLoanPeriod, String theCallNumber, double theDuration, String theDirector,
            MediaType theMedium, MPAARatings theRating)
            : base(theTitle, thePublisher, theCopyrightYear, theLoanPeriod, theCallNumber, theDuration)
        {
            Director = theDirector;
            Medium = theMedium;
            Rating = theRating;
        }
Exemplo n.º 9
0
    private MPAARatings _rating;                        // the movie's rating

    // Precondition:  theCopyrightYear >= 0
    //                theLoanPeriod >= 0
    //                theDuration >= 0
    //                theTitle,theDirector, and theCallNumber may not be null or empty
    // Postcondition: The library movie item has been initialized with the specified
    //                values for title, publisher, copyright year, loan period, call number,
    //                duration. The item is not checked out
    public LibraryMovie(string theTitle, string thePublisher, int theCopyrightYear, string theCallNumber,
                        int theLoanPeriod, double theDuration, string theDirector, MediaType theMedium, MPAARatings theRating) : base(theTitle, thePublisher,
                                                                                                                                      theCopyrightYear, theCallNumber, theLoanPeriod, theDuration)
    {
        Medium   = theMedium;
        Director = theDirector;
        Rating   = theRating;

        ReturnToShelf();             // Make sure movie is not checked out
    }
        public void OnGet()
        {
            Movies = MovieDatabase.All;

            if (SearchTerms != null)
            {
                Movies = MovieDatabase.All.Where(movie => movie.Title != null &&
                                                 movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase));
            }

            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie => movie.MPAARating != null &&
                                      MPAARatings.Contains(movie.MPAARating));
            }

            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie => movie.MajorGenre != null &&
                                      Genres.Contains(movie.MajorGenre));
            }

            if (IMDBMin != null || IMDBMax != null)
            {
                if (IMDBMin == null)
                {
                    Movies = Movies.Where(movie => movie.IMDBRating <= IMDBMax);
                }
                else if (IMDBMax == null)
                {
                    Movies = Movies.Where(movie => movie.IMDBRating >= IMDBMin);
                }
                else
                {
                    Movies = Movies.Where(movie => movie.IMDBRating >= IMDBMin && movie.IMDBRating <= IMDBMax);
                }
            }

            if (RTMin != null || RTMax != null)
            {
                if (RTMin == null)
                {
                    Movies = Movies.Where(movie => movie.RottenTomatoesRating <= RTMax);
                }
                else if (RTMax == null)
                {
                    Movies = Movies.Where(movie => movie.RottenTomatoesRating >= RTMin);
                }
                else
                {
                    Movies = Movies.Where(movie => movie.RottenTomatoesRating >= RTMin && movie.RottenTomatoesRating <= RTMax);
                }
            }
        }
        /*
         * /// <summary>
         * /// The current search terms
         * /// </summary>
         * [BindProperty]
         * public string SearchTerms { get; set; } = "";
         *
         * /// <summary>
         * /// The filtered MPAA Ratings
         * /// </summary>
         * [BindProperty]
         * public string[] MPAARatings { get; set; }
         *
         * /// <summary>
         * /// The filtered genres
         * /// </summary>
         * [BindProperty]
         * public string[] Genres { get; set; }
         *
         * /// <summary>
         * /// The minimum IMDB Rating
         * /// </summary>
         * [BindProperty]
         * public double? IMDBMin { get; set; }
         *
         * /// <summary>
         * /// The maximum IMDB Rating
         * /// </summary>
         * [BindProperty]
         * public double? IMDBMax { get; set; }
         */

        public void OnGet(double?IMDBMin, double?IMDBMax)
        {
            /*
             * MPAARatings = Request.Query["MPAARatings"];
             * String terms = Request.Query["SearchTerms"];
             * Movies = MovieDatabase.Search(SearchTerms);
             */
            //var MPAARatings = Request.Query["MPAARatings"];

            /*
             * //SearchTerms = Request.Query["SearchTerms"];
             * MPAARatings = Request.Query["MPAARatings"];
             * //IMDBMin = double.Parse(Request.Query["IMDBMin"]);
             * Movies = MovieDatabase.Search(SearchTerms);
             * Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
             *
             */

            /*
             * Movies = MovieDatabase.Search(SearchTerms);
             * Movies = MovieDatabase.Search(SearchTerms);
             * Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
             * Movies = MovieDatabase.FilterByGenre(Movies, Genres);
             * Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
             */

            /*
             * // Nullable conversion workaround
             * this.IMDBMin = IMDBMin;
             * this.IMDBMax = IMDBMax;
             * Movies = MovieDatabase.Search(SearchTerms);
             * Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
             * Movies = MovieDatabase.FilterByGenre(Movies, Genres);
             * Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
             */

            //search movie titles for the search terms
            Movies = MovieDatabase.All;
            if (SearchTerms != null)
            {
                Movies = Movies.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase));
                //.Select(movie => movie.Title)

                //Movies = from movie in Movies
                //where movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase)
                //select movie;
            }
            //filter by mpaa rating
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(Movie => Movie.MPAARating != null && MPAARatings.Contains(Movie.MPAARating));
            }
        }
        public SelectList GetAllRatingsWithID(int id)
        {
            string      MPAAStringToDisplay  = Enum.GetName(typeof(AllMPAARatings), id);
            MPAARatings MPAARatingsToDisplay = (MPAARatings)Enum.Parse(typeof(MPAARatings), MPAAStringToDisplay);
            var         MPAASelectList       = new SelectList(Enum.GetValues(typeof(AllMPAARatings)).Cast <AllMPAARatings>().Select(v => new SelectListItem
            {
                Text  = v.ToString(),
                Value = ((int)v).ToString()
            }).ToList(), "Value", "Text", ((int)MPAARatingsToDisplay + 1));

            return(MPAASelectList);
        }
 public void OnGet()
 {
     Movies = MovieDatabase.All;
     if (SearchTerms != null)
     {
         Movies.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.InvariantCultureIgnoreCase));
     }
     if (MPAARatings != null && MPAARatings.Length != 0)
     {
         Movies = Movies.Where(movie => movie.MPAARating != null && MPAARatings.Contains(movie.MPAARating));
     }
 }
        /// <summary>
        /// Gets the search results for display on the page
        /// </summary>
        public void OnGet(double?IMDBMin, double?IMDBMax, double?RottenMin, double?RottenMax)
        {
            // Nullable conversion workaround
            SearchTerms    = Request.Query["SearchTerms"];
            MPAARatings    = Request.Query["MPAARatings"];
            Genres         = Request.Query["Genres"];
            this.IMDBMin   = IMDBMin;
            this.IMDBMax   = IMDBMax;
            this.RottenMin = RottenMin;
            this.RottenMax = RottenMax;

            Movies = MovieDatabase.All;
            // Search movie titles for the SearchTerms
            if (SearchTerms != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.Title != null &&
                                      movie.Title.Contains(SearchTerms,
                                                           StringComparison.InvariantCultureIgnoreCase)
                                      );
            }
            // Filter by MPAA Rating
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MPAARating != null &&
                                      MPAARatings.Contains(movie.MPAARating)
                                      );
            }
            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MajorGenre != null &&
                                      Genres.Contains(movie.MajorGenre)
                                      );
            }
            if (IMDBMin != null && IMDBMax != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.IMDBRating <= IMDBMax &&
                                      movie.IMDBRating >= IMDBMin
                                      );
            }
            if (RottenMax != null && RottenMin != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.RottenTomatoesRating <= RottenMax &&
                                      movie.RottenTomatoesRating >= RottenMin
                                      );
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("MovieID,MovieNumber,Title,Overview,Tagline,RunTime,Year,Revenue,Actors,MPAARating")] Movie movie, int SelectedGenre, int SelectedMPAARating)
        {
            if (id != movie.MovieID)
            {
                return(View("Error2", new String[] { "Could not find this movie. Please Try Again." }));
            }


            if (SelectedGenre == 0 || SelectedMPAARating == 0)
            {
                ModelState.AddModelError("DropdownError", "Please verify that you have specified one Genre and one MPAA Rating.");

                ViewBag.AllGenres      = GetAllGenres();
                ViewBag.AllMPAARatings = GetAllRatings();
                return(View(movie));
            }

            if (ModelState.IsValid && SelectedGenre > 0 && SelectedMPAARating > 0)
            {
                try
                {
                    Genre dbGenre = _context.Genres.Find(SelectedGenre);

                    movie.Genre = dbGenre;

                    string      MPAAStringToDisplay  = Enum.GetName(typeof(AllMPAARatings), SelectedMPAARating);
                    MPAARatings MPAARatingsToDisplay = (MPAARatings)Enum.Parse(typeof(MPAARatings), MPAAStringToDisplay);
                    movie.MPAARating = MPAARatingsToDisplay;

                    _context.Update(movie);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MovieExists(movie.MovieID))
                    {
                        return(View("Error2", new String[] { "Could not find this movie. Please Try Again." }));
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            ViewBag.AllGenres      = GetAllGenres();
            ViewBag.AllMPAARatings = GetAllRatings();
            return(View(movie));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Does the response initialization for incoming GET requests
        /// </summary>
        public void OnGet(double?IMDBMin, double?IMDBMax, int?RottenMin, int?RottenMax)
        {
            // Nullable conversion workaround

            /*
             * this.IMDBMin = IMDBMin;
             * this.IMDBMax = IMDBMax;
             * this.RottenMin = RottenMin;
             * this.RottenMax = RottenMax;
             * MPAARatings = Request.Query["MPAARatings"];
             * Genres = Request.Query["Genres"];
             *
             * Movies = MovieDatabase.Search(SearchTerms);
             * Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
             * Movies = MovieDatabase.FilterByGenre(Movies, Genres);
             * Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
             * Movies = MovieDatabase.FilterByRottenTomatoesRating(Movies, RottenMin, RottenMax);
             */
            Movies = MovieDatabase.All;
            // Filter search terms
            if (SearchTerms != null)
            {
                Movies = Movies.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase));
            }

            // Filter MPAA rating
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie => movie.MPAARating != null && MPAARatings.Contains(movie.MPAARating));
            }

            // Filter Genre
            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie => movie.MajorGenre != null && Genres.Contains(movie.MajorGenre));
            }

            // Filter IMDB rating
            if (IMDBMax != null && IMDBMin != null)
            {
                Movies = Movies.Where(movie => movie.IMDBRating != null && movie.IMDBRating >= IMDBMin && movie.IMDBRating <= IMDBMax);
            }

            // Filter Rotten Tomatoes rating
            if (RottenMax != null && RottenMin != null)
            {
                Movies = Movies.Where(movie => movie.RottenTomatoesRating != null && movie.RottenTomatoesRating >= RottenMin && movie.RottenTomatoesRating <= RottenMax);
            }
        }
        public void OnGet()
        {
            Movies = MovieDatabase.All;

            //Search movie title for the search terms.
            if (SearchTerms != null)
            {
                Movies = Movies.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase));
            }

            //filter through MPAARatings
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MPAARating != null && MPAARatings.Contains(movie.MPAARating)
                                      );
            }

            //Filter through genres
            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MajorGenre != null && Genres.Contains(movie.MajorGenre)
                                      );
            }

            // Filter through IMDB Ratings
            if (IMDBMin == null && IMDBMax != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.IMDBRating != null && IMDBMax >= movie.IMDBRating
                                      );
            }

            if (IMDBMin != null && IMDBMax == null)
            {
                Movies = Movies.Where(movie =>
                                      movie.IMDBRating != null && IMDBMin <= movie.IMDBRating
                                      );
            }

            if (IMDBMin != null && IMDBMax != null)
            {
                Movies = Movies.Where(movie =>

                                      movie.IMDBRating != null && IMDBMin <= movie.IMDBRating && IMDBMax >= movie.IMDBRating
                                      );
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// Does the response initialization for incoming GET requests
        /// </summary>
        public void OnGet(double?IMDBMin, double?IMDBMax, double?RTMin, double?RTMax)
        {
            Movies = MovieDatabase.All;
            // Search movie titles for the SearchTerms
            if (SearchTerms != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.Title != null &&
                                      movie.Title.Contains(SearchTerms, StringComparison.InvariantCultureIgnoreCase));
            }

            // Filter by MPAA Rating
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MPAARating != null &&
                                      MPAARatings.Contains(movie.MPAARating));
            }

            // Filter by Genre
            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MajorGenre != null &&
                                      Genres.Contains(movie.MajorGenre));
            }

            //Filter by IMDB Rating
            if (IMDBMin != null || IMDBMax != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.IMDBRating != null &&
                                      (IMDBMin != null && IMDBMax == null && movie.IMDBRating >= IMDBMin) ||
                                      (IMDBMin == null && IMDBMax != null && movie.IMDBRating <= IMDBMax) ||
                                      (IMDBMin != null && IMDBMax != null && movie.IMDBRating >= IMDBMin && movie.IMDBRating <= IMDBMax));
            }

            //Filter by Rotten Tomatoes
            if (RTMin != null || RTMax != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.RottenTomatoesRating != null &&
                                      (RTMin != null && RTMax == null && movie.RottenTomatoesRating >= RTMin) ||
                                      (RTMin == null && RTMax != null && movie.RottenTomatoesRating <= RTMax) ||
                                      (RTMin != null && RTMax != null && movie.RottenTomatoesRating >= RTMin && movie.RottenTomatoesRating <= RTMax));
            }
        }
 /// <summary>
 /// Does the response initialization for incoming GET requests
 /// </summary>
 public void OnGet()
 {
     /*
      * Movies = MovieDatabase.Search(SearchTerms);
      * Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
      * Movies = MovieDatabase.FilterByGenre(Movies, Genres);
      * Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
      * Movies = MovieDatabase.FilterByRottenTomatoesRating(Movies, RottenTomatoesMin, RottenTomatoesMax);
      */
     Movies = MovieDatabase.All;
     // Search movie titles for the SearchTerms
     if (SearchTerms != null)
     {
         Movies = Movies.Where(movie =>
                               movie.Title != null &&
                               movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase)
                               );
     }
     // Filter by MPAA Rating
     if (MPAARatings != null && MPAARatings.Length != 0)
     {
         Movies = Movies.Where(movie =>
                               movie.MPAARating != null &&
                               MPAARatings.Contains(movie.MPAARating)
                               );
     }
     if (Genres != null && Genres.Length != 0)
     {
         Movies = Movies.Where(movie =>
                               movie.MajorGenre != null &&
                               Genres.Contains(movie.MajorGenre)
                               );
     }
     if (IMDBMin != null || IMDBMax != null)
     {
         Movies = Movies.Where(movie =>
                               movie.IMDBRating != null && movie.IMDBRating >= IMDBMin || movie.IMDBRating <= IMDBMax
                               );
     }
     if (RottenTomatoesMin != null || RottenTomatoesMax != null)
     {
         Movies = Movies.Where(movie =>
                               movie.RottenTomatoesRating != null && movie.RottenTomatoesRating >= RottenTomatoesMin || movie.RottenTomatoesRating <= RottenTomatoesMax
                               );
     }
 }
        /// <summary>
        /// Gets the search results for display on the page
        /// </summary>
        public void OnGet(double?IMDBMin, double?IMDBMax)
        {
            // Nullable conversion workaround

            /*
             * this.IMDBMin = IMDBMin;
             * this.IMDBMax = IMDBMax;
             * Movies = MovieDatabase.Search(SearchTerms);
             * Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
             * Movies = MovieDatabase.FilterByGenre(Movies, Genres);
             * Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
             */

            Movies = MovieDatabase.All;
            //search movie titles for the SearchTerms
            if (SearchTerms != null)
            {
                Movies = Movies.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.InvariantCultureIgnoreCase));
            }
            //Filter by MPAA rating
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie => movie.MPAARating != null && MPAARatings.Contains(movie.MPAARating));
            }
            //Filter by Genres
            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie => movie.MajorGenre != null && Genres.Contains(movie.MajorGenre));
            }
            //filter by price neither not null
            if (IMDBMax != null && IMDBMin != null)
            {
                Movies = Movies.Where(movie => movie.IMDBRating <= IMDBMax && movie.IMDBRating >= IMDBMin);
            }
            //Filter by Price max not null
            else if (IMDBMax != null)
            {
                Movies = Movies.Where(movie => movie.IMDBRating <= IMDBMax);
            }
            //filter by price min not null
            else if (IMDBMin != null)
            {
                Movies = Movies.Where(movie => movie.IMDBRating <= IMDBMin);
            }
        }
Exemplo n.º 21
0
 /// <summary>
 /// Gets the search results for display on the page
 /// </summary>
 public void OnGet()
 {
     Movies = MovieDatabase.All;
     // Search movie titles for the SearchTerms
     if (SearchTerms != null)
     {
         Movies = from movie in Movies
                  where movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.InvariantCultureIgnoreCase)
                  select movie;
     }
     // Filter by MPAA Rating
     if (MPAARatings != null && MPAARatings.Length != 0)
     {
         Movies = Movies.Where(movie =>
                               movie.MPAARating != null &&
                               MPAARatings.Contains(movie.MPAARating)
                               );
     }
 }
        public async Task <IActionResult> Create([Bind("MovieID,MovieNumber,Title,Overview,Tagline,RunTime,Year,Genre,Revenue,Actors,MPAARating")] Movie movie, int SelectedGenre, int SelectedMPAARating)
        {
            if (SelectedGenre == 0 || SelectedMPAARating == 0)
            {
                ModelState.AddModelError("DropdownError", "Please verify that you have specified one Genre and one MPAA Rating.");

                ViewBag.AllGenres      = GetAllGenres();
                ViewBag.AllMPAARatings = GetAllRatings();
                return(View(movie));
            }



            if (ModelState.IsValid && SelectedGenre > 0 && SelectedMPAARating > 0)
            {
                //Find the next Movie Number from the utilities class
                movie.MovieNumber = Utilities.GenerateNextMovieNumber.GetNextMovieNumber(_context);


                Genre dbGenre = _context.Genres.Find(SelectedGenre);

                movie.Genre = dbGenre;

                string      MPAAStringToDisplay  = Enum.GetName(typeof(AllMPAARatings), SelectedMPAARating);
                MPAARatings MPAARatingsToDisplay = (MPAARatings)Enum.Parse(typeof(MPAARatings), MPAAStringToDisplay);
                movie.MPAARating = MPAARatingsToDisplay;


                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }


            ViewBag.AllGenres      = GetAllGenres();
            ViewBag.AllMPAARatings = GetAllRatings();


            return(View(movie));
        }
        /// <summary>
        /// Gets the search results for display on the page
        /// </summary>
        public void OnGet(double?IMDBMin, double?IMDBMax)
        {
            this.IMDBMin = IMDBMin;
            this.IMDBMax = IMDBMax;
            Movies       = MovieDatabase.All;

            // Search movie titles for the SearchTerms
            if (SearchTerms != null)
            {
                Movies = Movies.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.InvariantCultureIgnoreCase));
            }
            // Filter by MPAA Rating
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MPAARating != null &&
                                      MPAARatings.Contains(movie.MPAARating)
                                      );
            }
            Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
            Movies = MovieDatabase.FilterByGenre(Movies, Genres);
            Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
        }
        /// <summary>
        /// Gets the search results for display on the page
        /// </summary>
        public void OnGet(double?IMDBMini, double?IMDBMaxi, double?RTMaxi, double?RTMini)
        {
            /*
             * //# Nullable conversion workaround
             *
             * this.IMDBMin = IMDBMini;
             * this.IMDBMax = IMDBMaxi;
             * //this.SearchTerms = SearchTerms;
             * // this.MPAARatings = MPAARatings;
             * //this.Genres = Genres;
             * this.RTMax = RTMaxi;
             * this.RTMin = RTMini;
             * SearchTerms = Request.Query["SearchTerms"];
             * MPAARatings = Request.Query["MPAARatings"];
             * Genres = Request.Query["Genres"];
             * Movies = MovieDatabase.All;
             *
             * Movies = MovieDatabase.Search(SearchTerms);
             * Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
             * Movies = MovieDatabase.FilterByGenre(Movies, Genres);
             * Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
             * Movies = MovieDatabase.FilterByRTRating(Movies, RTMin, RTMax);
             */
            Movies = MovieDatabase.All;
            if (SearchTerms != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.Title != null &&
                                      movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase));
            }
            //genre
            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MajorGenre != null &&
                                      Genres.Contains(movie.MajorGenre));
            }
            // Filter by MPAA Rating
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MPAARating != null &&
                                      MPAARatings.Contains(movie.MPAARating)
                                      );
            }
            //imdb
            if (IMDBMax != null && IMDBMax != 0)

            {
                Movies = Movies.Where(movie =>
                                      movie.IMDBRating <= IMDBMax);
            }
            if (IMDBMin != null && IMDBMin != 0)

            {
                Movies = Movies.Where(movie =>
                                      movie.IMDBRating >= IMDBMin);
            }
            if (IMDBMax != null && IMDBMax != 0 && IMDBMin != null && IMDBMin != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.IMDBRating >= IMDBMin && movie.IMDBRating <= IMDBMax);
            }
            //rotten
            if (RTMax != null && RTMax != 0)

            {
                Movies = Movies.Where(movie =>
                                      movie.RottenTomatoesRating <= RTMax);
            }
            if (RTMin != null && RTMin != 0)

            {
                Movies = Movies.Where(movie =>
                                      movie.RottenTomatoesRating >= RTMin);
            }
            if (RTMax != null && RTMax != 0 && RTMin != null && RTMin != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.RottenTomatoesRating >= RTMin && movie.RottenTomatoesRating <= RTMax);
            }
        }
Exemplo n.º 25
0
 //constructor
 public LibraryMovie(string theTitle, string thePublisher, int theCopyrightYear, int theLoanPeriod, string theCallNumber, double theDuration, string director, MediaType medium, MPAARatings rating)
     : base(theTitle, thePublisher, theCopyrightYear, theLoanPeriod, theCallNumber, theDuration)
 {
     director = _director;
     medium   = _medium;
     rating   = _rating;
 }
        public void OnPost()
        {
            //Filterable Database
            Movies = MovieDatabase.All;

            //Search movie titles for the SearchTerms
            if (SearchTerms != null)
            {
                Movies = Movies.Where(
                    movie => movie.Title != null &&
                    movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase)
                    );
            }

            //Filter by MPAA Rating
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(
                    movie => movie.MPAARating != null && MPAARatings.Contains(movie.MPAARating)
                    );
            }

            //Filter by Genre
            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(
                    movie => movie.MajorGenre != null && Genres.Contains(movie.MajorGenre)
                    );
            }

            //Filter by IMDB Rating
            if (IMDBMin != null && IMDBMax != null)
            {
                Movies = Movies.Where(
                    movie => movie.IMDBRating >= IMDBMin && movie.IMDBRating <= IMDBMax
                    );
            }
            else if (IMDBMin == null && IMDBMax != null)
            {
                Movies = Movies.Where(
                    movie => movie.IMDBRating <= IMDBMax
                    );
            }
            else
            {
                Movies = Movies.Where(
                    movie => movie.IMDBRating >= IMDBMin
                    );
            }

            //Filter by Rotten Tomatoes
            if (RottenMin != null && RottenMax != null)
            {
                Movies = Movies.Where(
                    movie => movie.RottenTomatoesRating >= RottenMin && movie.RottenTomatoesRating <= RottenMax
                    );
            }
            else if (IMDBMin == null && IMDBMax != null)
            {
                Movies = Movies.Where(
                    movie => movie.RottenTomatoesRating <= RottenMax
                    );
            }
            else
            {
                Movies = Movies.Where(
                    movie => movie.RottenTomatoesRating >= RottenMin
                    );
            }
        }
        /// <summary>
        /// Does the response initialization for incoming GET requests
        /// </summary>
        public void OnGet(double?IMDBMin, double?IMDBMax, double?RottenTomatoesMin, double?RottenTomatoesMax)
        {
            SearchTerms = Request.Query["SearchTerms"];
            MPAARatings = Request.Query["MPAARatings"];
            Genres      = Request.Query["Genres"];
            // Nullable conversion workaround
            this.IMDBMin           = IMDBMin;
            this.IMDBMax           = IMDBMax;
            this.RottenTomatoesMax = RottenTomatoesMax;
            this.RottenTomatoesMin = RottenTomatoesMin;

            Movies = MovieDatabase.All;
            //Search movie titles for search terms
            if (SearchTerms != null)
            {
                //Movies = MovieDatabase.All.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.InvariantCultureIgnoreCase));
                Movies = from movie in Movies
                         where movie.Title != null &&
                         movie.Title.Contains(SearchTerms, StringComparison.InvariantCultureIgnoreCase)
                         select movie;
            }
            //Filter by MPAARating
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MPAARating != null &&
                                      MPAARatings.Contains(movie.MPAARating)
                                      );
            }
            //Filter by Genre
            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MajorGenre != null &&
                                      Genres.Contains(movie.MajorGenre)
                                      );
            }
            //Movies = MovieDatabase.FilterByGenre(Movies, Genres);
            //Filter by IMDBRating
            if (IMDBMin != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.IMDBRating >= IMDBMin);
            }
            if (IMDBMax != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.IMDBRating <= IMDBMax);
            }
            //Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
            //Filter by Rotten Tomatoes
            if (RottenTomatoesMax != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.RottenTomatoesRating <= RottenTomatoesMax);
            }
            if (RottenTomatoesMin != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.RottenTomatoesRating >= RottenTomatoesMin);
            }
            //Movies = MovieDatabase.FilterByRottenTomatoesRating(Movies, RottenTomatoesMin, RottenTomatoesMax);
        }
        public async Task <IActionResult> DisplayReportResultsAsync(ReportSearchViewModel rsvm)
        {
            //Initial query LINQ
            var query = from m in _context.Ticket select m;

            query = query.Include(m => m.Showing).ThenInclude(m => m.Movie).Include(m => m.Order).ThenInclude(m => m.Purchaser);

            //If statements corresponding to each input form control

            if (rsvm.SelectedStartingDate != null) //For date
            {
                DateTime datSelectedStartingDate = rsvm.SelectedStartingDate ?? new DateTime(1900, 1, 1);
                query = query.Where(m => m.Showing.ShowingDate >= datSelectedStartingDate);
            }

            if (rsvm.SelectedEndingDate != null) //For date
            {
                DateTime datSelectedEndingDate = rsvm.SelectedEndingDate ?? new DateTime(1900, 1, 1);
                query = query.Where(m => m.Showing.ShowingDate <= datSelectedEndingDate);
            }

            if (rsvm.SelectedMovie != 0) //For movie name
            {
                Movie movie = _context.Movies.Find(rsvm.SelectedMovie);
                query = query.Where(m => m.Showing.Movie == movie);
            }

            if (rsvm.SelectedMPAARating != 0) //For MPAARating
            {
                string      MPAAStringToDisplay  = Enum.GetName(typeof(AllMPAARatings), rsvm.SelectedMPAARating);
                MPAARatings MPAARatingsToDisplay = (MPAARatings)Enum.Parse(typeof(MPAARatings), MPAAStringToDisplay);
                query = query.Where(m => m.Showing.Movie.MPAARating == MPAARatingsToDisplay);
            }

            if (rsvm.SelectedTime != null) //For showing time ********
            {
                DateTime timSelectedTime = rsvm.SelectedTime ?? new DateTime(1900, 1, 1);

                if (rsvm.SelectedSearchType == AllSearchTypes.GreaterThan)
                {
                    ModelState.AddModelError("NotSelected", "Please choose either before or after for your selected time.");
                    //Populate view bag with list of categories
                    ViewBag.AllMPAARatings = GetAllRatings();
                    ViewBag.AllMovies      = GetAllMovies();
                    return(View("ReportSearch", rsvm));
                }


                switch (rsvm.SelectedSearchType)
                {
                case AllSearchTypes.Before:
                    query = query.Where(m => m.Showing.StartTime.TimeOfDay <= timSelectedTime.TimeOfDay);
                    break;

                case AllSearchTypes.After:
                    query = query.Where(m => m.Showing.StartTime.TimeOfDay >= timSelectedTime.TimeOfDay);
                    break;

                default:
                    break;
                }
            }



            TryValidateModel(rsvm);
            if (ModelState.IsValid == false)
            {
                //re-populate ViewBag to have list of all categories & MPAA Ratings
                ViewBag.AllMPAARatings = GetAllRatings();
                ViewBag.AllMovies      = GetAllMovies();


                //View is returned with error messages
                return(View("ReportSearch", rsvm));
            }

            //Execute query

            List <Ticket>   SelectedTickets = query.Include(m => m.Showing).ThenInclude(m => m.Movie).Include(m => m.Order).ThenInclude(m => m.Purchaser).ToList();//.Where(r => r.TicketStatus == "Active").ToList();
            ReportViewModel rvm             = new ReportViewModel();

            if (rsvm.TotalRevenue != false)
            {
                rvm.TotalRevenue = SelectedTickets.Where(t => t.TicketStatus == "Active").Sum(r => r.TotalCost);
            }
            if (rsvm.TotalSeatsSold != false)
            {
                rvm.TotalSeatsSold = SelectedTickets.Where(t => t.TicketStatus == "Active").Count();
            }
            if (rsvm.ByCustomers != false)
            {
                IList <AppUser> users = await _userManager.GetUsersInRoleAsync("Customer");

                users        = users.Where(u => u.OrdersPurchased != null).ToList();
                rvm.AppUsers = (List <AppUser>)users;
                foreach (AppUser user in rvm.AppUsers)
                {
                    user.Tickets = SelectedTickets.Where(t => t.Order.Purchaser.UserName == user.UserName).ToList();
                }
                //rvm.Tickets = SelectedTickets;
            }
            if (rsvm.PPTickets != false)
            {
                rvm.PopcornPointTickets = SelectedTickets.Where(r => r.Order.PaidWithPopcornPoints == true && r.TicketStatus == "Active").ToList();
            }

            return(View("ReportSearchResults", rvm));
        }
Exemplo n.º 29
0
        /// <summary>
        /// Gets the search results for display on the page
        /// </summary>
        public void OnGet()
        {
            /*
             * Movies = MovieDatabase.Search(SearchTerms);
             * Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
             * Movies = MovieDatabase.FilterByGenre(Movies, MajorGenre);
             * Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
             * Movies = MovieDatabase.FilterByRottenTomatoesRating(Movies, RTMin, RTMax);*/

            Movies = MovieDatabase.All;
            //Search movie titles for SearchTerms
            if (SearchTerms != null)
            {
                //Movies = Movies.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.InvariantCultureIgnoreCase));
                Movies = from movie in Movies
                         where movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.InvariantCultureIgnoreCase)
                         select movie;
            }
            //Filter by MPAA Rating
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = from movie in Movies
                         where movie.MPAARating != null && MPAARatings.Contains(movie.MPAARating)
                         select movie;
            }
            //Filter by Genre
            if (MajorGenre != null && MajorGenre.Count() != 0)
            {
                Movies = from movie in Movies
                         where movie.MajorGenre != null && MajorGenre.Contains(movie.MajorGenre)
                         select movie;
            }
            //Filter by IMDB Rating
            if (IMDBMin == null && IMDBMax != null)
            {
                Movies = from movie in Movies
                         where movie.IMDBRating <= IMDBMax
                         select movie;
            }
            if (IMDBMin != null && IMDBMax == null)
            {
                Movies = from movie in Movies
                         where movie.IMDBRating >= IMDBMin
                         select movie;
            }
            if (IMDBMin != null && IMDBMax != null)
            {
                Movies = from movie in Movies
                         where movie.IMDBRating >= IMDBMin && movie.IMDBRating <= IMDBMax
                         select movie;
            }
            //Filter by Rotten Tomatoes Rating
            if (RTMin == null && RTMax != null)
            {
                Movies = from movie in Movies
                         where movie.RottenTomatoesRating <= RTMax
                         select movie;
            }
            if (RTMin != null && RTMax == null)
            {
                Movies = from movie in Movies
                         where movie.RottenTomatoesRating >= RTMin
                         select movie;
            }
            if (RTMin != null && RTMax != null)
            {
                Movies = from movie in Movies
                         where movie.RottenTomatoesRating >= RTMin && movie.RottenTomatoesRating <= RTMax
                         select movie;
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Gets the search results for display on the page
        /// </summary>
        public void OnGet(double?IMDBMin, double?IMDBMax, int?RottenMin, int?RottenMax)
        {
            this.IMDBMin   = IMDBMin;
            this.IMDBMax   = IMDBMax;
            this.RottenMin = RottenMin;
            this.RottenMax = RottenMax;
            SearchTerms    = Request.Query["SearchTerms"];
            MPAARatings    = Request.Query["MPAARatings"];
            Genres         = Request.Query["Genres"];
            Movies         = MovieDatabase.All;
            if (SearchTerms != null)
            {
                Movies = MovieDatabase.All.Where(movie =>
                                                 movie.Title != null &&
                                                 movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase)
                                                 );
            }
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MPAARating != null &&
                                      MPAARatings.Contains(movie.MPAARating)
                                      );
            }
            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MajorGenre != null &&
                                      Genres.Contains(movie.MajorGenre)
                                      );
            }
            if (!(IMDBMin == null && IMDBMax == null))
            {
                if (IMDBMin == null && IMDBMax != null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.IMDBRating <= IMDBMax
                                          );
                }
                else if (IMDBMin != null && IMDBMax == null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.IMDBRating >= IMDBMin
                                          );
                }
                else
                {
                    Movies = Movies.Where(movie =>
                                          movie.IMDBRating >= IMDBMin &&
                                          movie.IMDBRating <= IMDBMax
                                          );
                }
            }
            if (Genres != null && Genres.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MajorGenre != null &&
                                      Genres.Contains(movie.MajorGenre)
                                      );
            }
            if (!(RottenMin == null && RottenMax == null))
            {
                if (RottenMin == null && RottenMax != null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.RottenTomatoesRating <= RottenMax
                                          );
                }
                else if (RottenMin != null && RottenMax == null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.RottenTomatoesRating >= RottenMin
                                          );
                }
                else
                {
                    Movies = Movies.Where(movie =>
                                          movie.RottenTomatoesRating >= RottenMin &&
                                          movie.RottenTomatoesRating <= RottenMax
                                          );
                }
            }



            /*
             * Movies = MovieDatabase.Search(SearchTerms);
             * Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
             * Movies = MovieDatabase.FilterByGenre(Movies, Genres);
             * Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
             * Movies = MovieDatabase.FilterByRottenTomatoesRating(Movies, RottenMin, RottenMax);
             */
        }
        /// <summary>
        /// Posts the search results for display on the page
        /// </summary>
        /// <param name="IMDBMin">The minimum IMDB Rating</param>
        /// <param name="IMDBMax">The maximum IMDB Rating</param>
        /// <param name="RottenMin">The minimum Rotten Tomatoes Rating</param>
        /// <param name="RottenMax">The maximum Rotten Tomatoes Rating</param>
        public void OnPost()
        {
            /*
             * Movies = MovieDatabase.Search(SearchTerms);
             * Movies = MovieDatabase.FilterByMPAARating(Movies, MPAARatings);
             * Movies = MovieDatabase.FilterByGenre(Movies, Genres);
             * Movies = MovieDatabase.FilterByIMDBRating(Movies, IMDBMin, IMDBMax);
             * Movies = MovieDatabase.FilterByRottenTomatoesRating(Movies, RottenMin, RottenMax);
             */

            Movies = MovieDatabase.All;

            // Search movie titles for the SearchTerms
            if (SearchTerms != null)
            {
                Movies = Movies.Where(movie =>
                                      movie.Title != null &&
                                      movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase)
                                      );
            }
            // Filter by MPAA Ratings
            if (MPAARatings != null && MPAARatings.Length != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MPAARating != null &&
                                      MPAARatings.Contains(movie.MPAARating)
                                      );
            }
            // Filter by Genre
            if (Genres != null && Genres.Count() != 0)
            {
                Movies = Movies.Where(movie =>
                                      movie.MajorGenre != null &&
                                      Genres.Contains(movie.MajorGenre)
                                      );
            }
            // Filter by IMBD Rating
            if (IMDBMax != null || IMDBMin != null)
            {
                // Min is null
                if (IMDBMin == null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.IMDBRating <= IMDBMax
                                          );
                }
                // Max is null
                if (IMDBMax == null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.IMDBRating >= IMDBMin
                                          );
                }
                // Both are specified
                if (IMDBMax != null && IMDBMin != null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.IMDBRating >= IMDBMin &&
                                          movie.IMDBRating <= IMDBMax
                                          );
                }
            }
            // Filter by RottenTomatoes Rating
            if (RottenMax != null || RottenMin != null)
            {
                // Min is null
                if (RottenMin == null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.RottenTomatoesRating <= RottenMax
                                          );
                }
                // Max is null
                if (RottenMax == null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.RottenTomatoesRating >= RottenMin
                                          );
                }
                // Both are specified
                if (RottenMax != null && RottenMin != null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.RottenTomatoesRating >= RottenMin &&
                                          movie.RottenTomatoesRating <= RottenMax
                                          );
                }
            }
        }