Exemple #1
0
        public async Task <ActionResult <IEnumerable <GameReadDto> > > GetUserGames()
        {
            var user = await _userManager.FindByEmailAsync(HttpContext.User.Identity.Name);

            var games = _repository.GetAllGames().Where(g => g.IdentityId == user.Id);

            return(Ok(_mapper.Map <IEnumerable <GameReadDto> >(games)));
        }
Exemple #2
0
        public IActionResult Index(bool search)
        {
            homeViewModel.Games = CreateGameCards(gamesTable.GetAllGames());

            if (User.Identity.IsAuthenticated)
            {
                User user = usersTable.GetUserByEmail(User.Identity.Name !) !;


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

            ViewBag.isRedirectedFromOtherPageBySearchBtn = search;

            return(View(homeViewModel));
        }
Exemple #3
0
        public List <Game> GetAllGames()
        {
            List <Game> game = repo.GetAllGames();

            return(game);
        }
        public IActionResult Index()
        {
            var games = gameRepo.GetAllGames();

            return(View(games));
        }