示例#1
0
        /* Step 3 */                    /* Step 10 */
        public ActionResult SearchResult(FilmSearchViewModel searchModel)
        {
            /* Step 14 */
            IList <Film> films = _dal.SearchFilms(searchModel.Title, searchModel.Description, searchModel.ReleaseYear, searchModel.MinLength, searchModel.MaxLength, searchModel.Rating);

            /* Step 15 */
            return(View(films));
        }
示例#2
0
        /// <summary>
        /// Receives the search result request and goes to th database looking for the information.
        /// </summary>
        /// <param name="request">A request model that contains the search parameters.</param>
        /// <returns></returns>
        //public ActionResult SearchResult(/*FilmSearch request */)
        //public ActionResult SearchResult(string genre, int? minLength, int? maxLength)
        //{
        //    //IList<Film> filmlist = dal.GetFilmsBetween(film.Length);

        //    IList<Film> filmList = dal.GetFilmsBetween(genre, minLength?? 0, maxLength?? 60*24);

        //    return View("SearchResult", filmList);
        //    /* Call the DAL and pass the values as a model back to the View */
        //}
        public ActionResult SearchResult(FilmSearchViewModel filmSearch)
        {
            //IList<Film> filmlist = dal.GetFilmsBetween(film.Length);

            IList <Film> filmList = dal.GetFilmsBetween(filmSearch.Genre, filmSearch.MinLength ?? 0, filmSearch.MaxLength ?? 60 * 24);

            return(View("SearchResult", filmList));
            /* Call the DAL and pass the values as a model back to the View */
        }
示例#3
0
        public FilmsController(IFilmDAL filmDal)
        {
            _filmDal = filmDal;

            _filmSearchModel = new FilmSearchViewModel();

            IList <string> genres = _filmDal.GetGenres();

            foreach (string genre in genres)
            {
                _filmSearchModel.PopulateGenresDropdown(genre);
            }
        }
示例#4
0
        public ActionResult Index()
        {
            var model      = new FilmSearchViewModel();
            var genreItems = new List <SelectListItem>();

            foreach (string genre in _filmDal.GetGenres())
            {
                genreItems.Add(new SelectListItem {
                    Text = genre
                });
            }
            model.Genres = genreItems;

            return(View(model));
        }