Example #1
0
        public IActionResult AddGame()
        {
            User user = usersTable.GetUserByEmail(User.Identity.Name !) !;

            ViewBag.User       = user;
            ViewData["layout"] = "~/Views/Shared/_AuthorizedLayout.cshtml";

            if (!user.IsAdmin)
            {
                return(RedirectToAction("AccessDenied", "ErrorPage"));
            }

            viewModel = new GameManagementViewModel {
                Genres   = genresTable.GetAllGenres(),
                Features = featuresTable.GetAllFeatures()
            };

            return(View(viewModel));
        }
Example #2
0
        public HomeController(IGameRepo gameR, IFeatureRepo featureR, IGenreRepo genreR, IPriceCategoryRepo categoryR, IUserRepo userR)
        {
            gamesTable           = gameR;
            featuresTable        = featureR;
            genresTable          = genreR;
            priceCategoriesTable = categoryR;
            usersTable           = userR;

            homeViewModel = new HomeViewModel {
                FeaturesFilters = featuresTable.GetAllFeatures(),
                GenresFilters   = genresTable.GetAllGenres(),
                PriceFilters    = priceCategoriesTable.GetAllCategories()
            };
        }