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) ); } }
private void updateObservableListings() /* call whenever adding/removing a movie from static list */ { Genres.Clear(); Directors.Clear(); Actors.Clear(); foreach (Genre genre in NeoSingleton._allGenres()) { if (!Genres.Contains(genre.Name)) { Genres.Add(genre.Name); } } foreach (Director director in NeoSingleton._allDirectors()) { if (!Directors.Contains(director.Name)) { Directors.Add(director.Name); } } foreach (Actor actor in NeoSingleton._allActors()) { if (!Actors.Contains(actor.Name)) { Actors.Add(actor.Name); } } }
/// <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)); } }
private static List <string> SetGenre(string genres) { if (!Genres.Contains(genres)) { Genres.Add(genres); } return(Genres); }
/// <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); } }
private bool FindMatchingGenres(ShowItem show) { if (show.Genres == null) { return(false); } return(show.Genres.Any(showGenre => Genres.Contains(showGenre))); }
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> /// 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 ); } }
/// <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); } }
private void tbGenres_TextChanged(object sender, EventArgs e) { IsLoadedGenres = false; string text = tbGenres.Text; lvGenres.Clear(); ColumnHeader header = new ColumnHeader(); header.Text = ""; header.Name = "col1"; lvGenres.Columns.Add(header); lvGenres.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); lvGenres.HeaderStyle = ColumnHeaderStyle.None; try { using (MovieDB context = new MovieDB()) { lvGenres.CheckBoxes = true; List <genre> genres = null; if (text.Equals("")) { genres = (from c in context.genres where c.active == 1 orderby c.name select c).ToList(); } else { genres = (from c in context.genres where c.name.ToLower().StartsWith(text.ToLower()) && c.active == 1 orderby c.name select c).ToList(); } foreach (var genre in genres) { var item = new ListViewItem(genre.name); item.Tag = genre; lvGenres.Items.Add(item); if (Genres.Contains(genre)) { item.Checked = true; } } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } IsLoadedGenres = true; }
/// <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> /// Adds a genre to the item /// </summary> /// <param name="name">The name.</param> /// <exception cref="System.ArgumentNullException"></exception> public void AddGenre(string name) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(); } if (Genres == null) { Genres = new List <string>(); } if (!Genres.Contains(name, StringComparer.OrdinalIgnoreCase)) { Genres.Add(name); } }
/// <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); } }
public void OnGet(string SearchTerms, string[] MPAARatings, string[] Genre, double?IMDBMin, double?IMDBMax) { /* * 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.FilterByRottenTomatoRating(Movies, IMDBMin, IMDBMax); */ Movies = MovieDatabase.All; // Search movie titles for SearchTerms if (SearchTerms != null) { Movies = Movies.Where(movie => movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.CurrentCultureIgnoreCase)); //Movies = from movie in Movies where movie.Title != null && movie.Title.Contains(SearchTerms, StringComparison.OrdinalIgnoreCase) select movie; } // 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 (Genre != null && Genre.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); Movies = Movies.Where(movie => movie.IMDBRating >= IMDBMin); Movies = Movies.Where(movie => movie.IMDBRating >= IMDBMin && movie.IMDBRating <= IMDBMax); } // Filter by Rotten Tomato Rating if (IMDBMin != null && IMDBMax != null) { Movies = Movies.Where(movie => movie.IMDBRating <= IMDBMax); Movies = Movies.Where(movie => movie.IMDBRating >= IMDBMin); Movies = Movies.Where(movie => movie.IMDBRating >= IMDBMin && movie.IMDBRating <= IMDBMax); } }
private void updateObservableListings() /* call whenever adding/removing a movie from static list */ { Genres.Clear(); Directors.Clear(); Actors.Clear(); foreach (Movie movie in movieList.Instance.listMovieValues) { if (movie.Genres != null) { foreach (Genre genre in movie.Genres) { if (!Genres.Contains(genre.Name)) { Genres.Add(genre.Name); } } } if (movie.Directors != null) { foreach (Director director in movie.Directors) { if (!Directors.Contains(director.Name)) { Directors.Add(director.Name); } } } if (movie.Actors != null) { foreach (Actor actor in movie.Actors) { if (!Actors.Contains(actor.Name)) { Actors.Add(actor.Name); } } } } Actors = new ObservableCollection <string>(Actors.OrderBy(o => o).ToList()); Directors = new ObservableCollection <string>(Directors.OrderBy(o => o).ToList()); Genres = new ObservableCollection <string>(Genres.OrderBy(o => o).ToList()); }
/// <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); } }
private bool FindMatchingGenres([NotNull] ShowItem show) { return(Genres is null || show.Genres.Any(showGenre => Genres.Contains(showGenre))); }
/// <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); }
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 ); } }
private bool FindMatchingGenres([NotNull] ShowConfiguration show) { return(show.Genres.Any(showGenre => Genres.Contains(showGenre))); }
/// <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); } } }