public string SearchMovies(string input) { var movies = new List<StopNShop_1.Models.Objects.Movie>(); var parameterList = input.Split(','); var director = parameterList[0]; var genre = parameterList[1]; var movieSearchDAL = new MovieSearchDAL(); try { if (director.Length > 0 && genre.Length > 0) { movies = movieSearchDAL.searchMoviesByDirectorGenre(director, genre,1); } else if (director.Length > 0) { movies = movieSearchDAL.searchMoviesByDirectorGenre(director, genre, 2); } else if (genre.Length > 0) { movies = movieSearchDAL.searchMoviesByDirectorGenre(director, genre, 3); } } catch(Exception) { } JavaScriptSerializer jsonObj = new JavaScriptSerializer(); return jsonObj.Serialize(movies); }
// // GET: /MovieSearch/ public ActionResult Index() { var movieSearchDAL = new MovieSearchDAL(); ViewBag.Genres = new List<string>(); ViewBag.Directors = new List<string>(); try { ViewBag.Genres = movieSearchDAL.GetMovieGenres(); ViewBag.Directors = movieSearchDAL.GetMovieDirectors(); } catch(Exception){ } return View(); }
public string SearchTopFiveMovies() { var movies = new List<StopNShop_1.Models.Objects.Movie>(); var movieSearchDAL = new MovieSearchDAL(); try { movies = movieSearchDAL.GetTopFiveMovies(); } catch (Exception) { } JavaScriptSerializer jsonObj = new JavaScriptSerializer(); return jsonObj.Serialize(movies); }