コード例 #1
0
        public ActionResult Index(string gekozenGenre)
        {
            if (gekozenGenre == "Alles")
            {
                return(RedirectToAction("Index"));
            }
            TicketAuthenticator auth = new TicketAuthenticator();
            Account             acc  = _accountRepository.GetAccountById(auth.Decrypt());

            acc.Films      = _filmRepository.GetBoughtFilms(acc.Id);
            acc.Winkelmand = new Winkelmand
            {
                Films = _winkelmandRepository.GetFilmsInWinkelmand(_winkelmandRepository.GetWinkelmandId(acc.Id))
            };
            FilmIndexViewmodel viewmodel = new FilmIndexViewmodel
            {
                ListGenres    = _genreRepository.GetAllGenres(),
                ListFilm      = new List <Film>(),
                Account       = acc,
                AllFilmsCount = _filmRepository.GetAllFilms().Count
            };
            List <int> filmIds = _genreRepository.GetFilmsWithGenre(gekozenGenre);

            foreach (int id in filmIds)
            {
                viewmodel.ListFilm.Add(_filmRepository.GetById(id));
            }
            return(View(viewmodel));
        }
コード例 #2
0
ファイル: FilmController.cs プロジェクト: mepbat/Film-Webshop
        public ActionResult Index()
        {
            TicketAuthenticator auth  = new TicketAuthenticator();
            List <Film>         films = new List <Film>();
            Account             acc   = _accountRepository.GetAccountById(auth.Decrypt());

            acc.Winkelmand       = new Winkelmand();
            acc.Winkelmand.Films = _winkelmandRepository.GetFilmsInWinkelmand(_winkelmandRepository.GetWinkelmandId(acc.Id));;
            FilmIndexViewmodel viewmodel = new FilmIndexViewmodel
            {
                ListFilm   = _filmRepository.GetAllFilms(),
                ListGenres = _genreRepository.GetAllGenres(),
                Account    = acc
            };

            return(View(viewmodel));
        }