public FilmsController(IFilmDAL filmDal) { _filmDal = filmDal; _filmSearchModel = new FilmSearchViewModel(); IList <string> genres = _filmDal.GetGenres(); foreach (string genre in genres) { _filmSearchModel.PopulateGenresDropdown(genre); } }
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)); }