예제 #1
0
        public FilmsController(IFilmDAL filmDal)
        {
            _filmDal = filmDal;

            _filmSearchModel = new FilmSearchViewModel();

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

            foreach (string genre in genres)
            {
                _filmSearchModel.PopulateGenresDropdown(genre);
            }
        }
예제 #2
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));
        }