Esempio n. 1
0
        public IActionResult FindGame()
        {
            FindGameViewModel findGameVM = new FindGameViewModel()
            {
                Game = _unitOfWork.Game.GetAll(c => c.Status == SD.Pending),
                TotalRegisteredPlayersForGame = new Dictionary <int, int>(),
                AlreadyRegisteredGames        = new List <int>()
            };

            foreach (var game in findGameVM.Game)
            {
                findGameVM.TotalRegisteredPlayersForGame.Add(game.Id, _unitOfWork.GameUser.RegisteredPlayers(game.Id));
            }

            //Get current user Id
            var claimsIdentity = (ClaimsIdentity)this.User.Identity;
            var claims         = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier);

            findGameVM.AlreadyRegisteredGames = _unitOfWork.GameUser.GameRegisteredPerUser(claims.Value);

            return(View(findGameVM));
        }
 private void FindNetworkGame()
 {
     Popup = new FindGameViewModel(AppModel.EventAggregator) { Title = "Find a game." };
 }