コード例 #1
0
        public void OnPost()
        {
            Movies = MovieDatabase.All;

            if (search != null && mpaa.Count != 0)
            {
                Movies = MovieDatabase.SearchAndFilter(search, mpaa);
            }
            else if (mpaa.Count != 0)
            {
                Movies = MovieDatabase.Filter(mpaa);
            }
            else if (search != null)
            {
                Movies = MovieDatabase.Search(Movies, search);
            }
            else
            {
                Movies = MovieDatabase.All;
            }

            if (mpaa.Count != 0)
            {
                Movies = MovieDatabase.FilterByMPAA(Movies, mpaa);
            }

            if (minIMDB != null)
            {
                Movies = MovieDatabase.FilterByMinIMDB(Movies, (float)minIMDB);
            }
        }
コード例 #2
0
        public void OnPost(string search, List <string> rating, float?minIMDB, float?maxIMDB)
        {
            Movies = MovieDatabase.All;

            if (search != null && rating.Count != 0)
            {
                Movies = MovieDatabase.SearchAndFilter(search, rating);
            }
            else if (rating.Count != 0)
            {
                Movies = MovieDatabase.Filter(rating);
            }
            else if (search != null)
            {
                Movies = MovieDatabase.Search(Movies, search);
            }
            else
            {
                Movies = MovieDatabase.All;
            }

            if (rating.Count != 0)
            {
                Movies = MovieDatabase.FilterByMPAA(Movies, rating);
            }

            if (minIMDB != null)
            {
                Movies = MovieDatabase.FilterByMinIMDB(Movies, (float)minIMDB);
            }
        }
コード例 #3
0
        public void Onpost()
        {
            Movies = MovieDatabase.All;


            if (search != null && mapp.Count != 0)
            {
                Movies = MovieDatabase.SearchAndFilter(search, mapp);
            }
            else if (mapp.Count != 0)
            {
                Movies = MovieDatabase.Filter(mapp);
            }

            else if (search != null)
            {
                Movies = MovieDatabase.Search(Movies, search);
            }


            if (mapp.Count != 0)
            {
                Movies = MovieDatabase.FilterByMPAA(Movies, mapp);
            }

            if (minIMDB != null)
            {
                Movies = MovieDatabase.FilterByBinIMDB(Movies, (float)minIMDB);
            }
            if (maxIMDB != null)
            {
                Movies = MovieDatabase.FilterByMaxIMDB(Movies, (float)maxIMDB);
            }
        }
コード例 #4
0
        public void OnPost()
        {
            Movies = MovieDatabase.FilterIMBD(minIMBD, maxIMBD);

            if (rating.Count != 0)
            {
                Movies = MovieDatabase.Filter(rating, Movies);
            }
            if (search != null)
            {
                Movies = MovieDatabase.Search(search, Movies);
            }
        }
コード例 #5
0
        public void OnPost(string search, List <string> mpaa, double?IMBD)
        {
            Movies = MovieDatabase.All;

            if (search != null)
            {
                Movies = MovieDatabase.Search(Movies, search);
            }
            if (mpaa.Count > 0)
            {
                Movies = MovieDatabase.Filter(Movies, mpaa);
            }
            if (IMBD != null)
            {
                Movies = MovieDatabase.FilterByIMBD(Movies, IMBD);
            }
        }
コード例 #6
0
        public void OnPost(string search, List <string> mpaa)
        {
            Movies = MovieDatabase.All;

            if (search != null)
            {
                Movies = MovieDatabase.Search(Movies, search);
            }

            if (mpaa.Count > 0)
            {
                Movies = MovieDatabase.Filter(Movies, mpaa);
            }

            if (minIMDB is float min)
            {
                Movies = MovieDatabase.FilterByMinIMDB(Movies, min);
            }
        }
コード例 #7
0
        public void OnPost()
        {
            Movies = MovieDatabase.All;

            if (rating.Count != 0)
            {
                Movies = MovieDatabase.Filter(Movies, rating);
            }

            if (search != null)
            {
                Movies = MovieDatabase.Search(Movies, search);
            }

            if (minIMDb != null)
            {
                Movies = MovieDatabase.FilterByMinIMDb(Movies, (float)minIMDb);
            }
        }
コード例 #8
0
 public void OnPost(string search, List <string> rating)
 {
     if (search != null && rating.Count != 0)
     {
         Movies = movieDatabase.SearchAndFilter(search, rating);
     }
     else if (rating.Count != 0)
     {
         Movies = movieDatabase.Filter(rating);
     }
     else if (search != null)
     {
         Movies = movieDatabase.Search(search);
     }
     else
     {
         Movies = movieDatabase.All;
     }
 }
コード例 #9
0
        public void OnPost(string search, List <string> rating, float?maxIMDB, float?minIMDB)
        {
            Movies = MovieDatabase.All;

            if (search != null && rating.Count != 0)
            {
                Movies = MovieDatabase.SearchAndFilter(search, rating);
            }
            else if (rating.Count != 0)
            {
                Movies = MovieDatabase.Filter(rating);
            }
            else if (search != null)
            {
                // Movies = MovieDatabase.Search(Movies,search);
                Movies = Movies.Where(movie => movie.Title.Contains(search, StringComparison.OrdinalIgnoreCase));
            }
            else
            {
                Movies = MovieDatabase.All;
            }

            if (rating.Count != 0)
            {
                Movies = Movies.Where(movie => mpaa.Contains(movie.MPAA_Rating));
                // Movies = MovieDatabase.FilterByMPAA(Movies, rating);
            }
            if (minIMDB != null)
            {
                Movies = Movies.Where(movie => movie.IMDB_Rating != null && movie.IMDB_Rating >= minIMDB);
                //  Movies = MovieDatabase.FilterByMinIMDB(Movies, (float)minIMDB);
            }

            if (maxIMDB != null)
            {
                Movies = Movies.Where(movie => movie.IMDB_Rating != null && movie.IMDB_Rating <= maxIMDB);
            }

            switch (sort)
            {
            case "title":
                Movies = Movies.OrderBy(movie => movie.Title);
                break;

            case "director":
                Movies = Movies
                         .Where(movie => movie.Director != null)
                         .OrderBy(movie => { string[] parts = movie.Director.Split(" "); return(parts[parts.Length - 1]); });
                break;

            case "mpaa":
                Movies = Movies.OrderBy(movie => movie.MPAA_Rating);
                break;

            case "imdb":
                Movies = Movies.OrderBy(movie => movie.IMDB_Rating);
                break;

            case "rt":
                Movies = Movies.Where(movie => movie.Rotten_Tomatoes_Rating != null)
                         .OrderBy(movie => movie.Rotten_Tomatoes_Rating);
                break;
            }
            Movies = Movies.OrderBy(movie => movie.Title);
        }