Esempio n. 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));
        }
Esempio n. 2
0
        public ActionResult Credits()
        {
            TicketAuthenticator auth = new TicketAuthenticator();
            Account             acc  = _accountRepository.GetAccountById(auth.Decrypt());

            return(View(acc));
        }
Esempio n. 3
0
        public ActionResult Login(Account acc)
        {
            if (acc.Email == null || acc.Wachtwoord == null)
            {
                ViewBag.Message1 = "Vul een email en wachtwoord in.";
                return(View());
            }
            TicketAuthenticator ticket = new TicketAuthenticator();

            acc = new Account(acc.Email, PasswordManager.Hash(acc.Wachtwoord));
            acc = _accountRepository.LoginAccount(acc);
            if (acc == null)
            {
                ViewBag.Message = "Dit is geen geregistreerd account. Check of de ingevulde gegevens kloppen.";
                return(View());
            }
            acc = new Account(acc.Id, acc.Credits, acc.Email, PasswordManager.Hash(acc.Wachtwoord), acc.Admin);
            HttpCookie c = ticket.Encrypt(acc.Id.ToString());

            HttpContext.Response.Cookies.Add(c);
            if (acc.Admin)
            {
                return(RedirectToAction("Toevoegen", "Film"));
            }
            return(RedirectToAction("Index", "Film"));
        }
Esempio n. 4
0
        public ActionResult Films()
        {
            TicketAuthenticator auth = new TicketAuthenticator();
            int     accId            = auth.Decrypt();
            Account acc = _accountRepository.GetAccountById(accId);

            acc.Films = _filmRepository.GetBoughtFilms(accId);
            AccountFilmsViewmodel viewmodel = new AccountFilmsViewmodel
            {
                Genres  = _genreRepository.GetAllGenres(),
                Account = acc
            };

            return(View(viewmodel));
        }
Esempio n. 5
0
        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));
        }