Exemplo n.º 1
0
        public ActionResult OnGet()
         {
            if (!User.Identity.IsAuthenticated)
            {
                return RedirectToPage("/Account/Login", new { area = "Identity" });
            }
            try
            {
                string cs = _config.GetConnectionString("Default");
                Films = fd.GetFilmList(cs);
                Users = fd.GetUserList(cs);
                var genres = fd.GetGenreList(cs);

                Genre = new List<SelectListItem>();

                genres.ForEach(x =>
                {
                    Genre.Add(new SelectListItem { Value = x.GenreID.ToString(), Text = x.GenreText });
                });

                RandomFilm = fd.GetRandomFilm(cs);

                return Page();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }