/// <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));
     }
 }
Exemple #2
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)
                                      );
            }
        }
        /// <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);
            }
        }
        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 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 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
                                      );
            }
        }
Exemple #10
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);
            }
        }
Exemple #11
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);
            }
        }
 /// <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)
                               );
     }
 }
        /// <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);
        }
        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>
        /// 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);
            }
        }
        /// <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
                                          );
                }
            }
        }
        /// <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);
        }
Exemple #20
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;
            }
        }
        /// <summary>
        /// Gets the search results for display on the page
        /// </summary>
        public void OnGet(double?IMDBMin, double?IMDBMax, double?RottenMin, double?RottenMax)
        {
            //this.IMDBMin = IMDBMin;
            //this.IMDBMax = IMDBMax;
            //this.RottenMax = RottenMax;
            //this.RottenMin = RottenMin;
            //SearchTerms = Request.Query["SearchTerms"];
            //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.FilterByRottenTomatoes(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 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 IMDB rating
            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);
            }

            //Filter by Rotten Tomatoe rating
            if (RottenMin == null && RottenMax != null)
            {
                Movies = Movies.Where(movie => movie.RottenTomatoesRating <= RottenMax);
            }

            if (RottenMax == null && RottenMin != null)
            {
                Movies = Movies.Where(movie => movie.RottenTomatoesRating >= RottenMin);
            }

            if (RottenMax != null && RottenMin != null)
            {
                Movies = Movies.Where(movie => movie.RottenTomatoesRating >= RottenMin && movie.RottenTomatoesRating <= RottenMax);
            }
        }
Exemple #22
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>
        /// Does the response initialization for incoming GET requests
        /// </summary>
        public void OnGet(double?IMDBMin, double?IMDBMax)
        {
            SearchTerms = Request.Query["SearchTerms"];
            MPAARatings = Request.Query["MPAARatings"];
            Genres      = Request.Query["Genres"];

            // 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.FilterByTomatoes(Movies, TomatoesMin, TomatoesMax);
             */

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

            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 (!(TomatoesMin == null && TomatoesMax == null))
            {
                if (TomatoesMin == null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.RottenTomatoesRating <= TomatoesMax);
                }
                else if (TomatoesMax == null)
                {
                    Movies = Movies.Where(movie =>
                                          movie.RottenTomatoesRating >= TomatoesMin);
                }
                else
                {
                    Movies = Movies.Where(movie =>
                                          movie.RottenTomatoesRating >= TomatoesMin &&
                                          movie.RottenTomatoesRating <= TomatoesMax);
                }
            }
        }