public async Task <ActionResult> GetPlayer(string gamertag)
        {
            // Call data store
            var player = await _store.GetPlayerDetailsAsync(gamertag);

            if (player == null)
            {
                return(NotFound());
            }

            // Return result
            return(Ok(PlayerGetResponseModel.FromPlayer(player)));
        }
Example #2
0
        public async Task <ActionResult> GetCurrentPlayer()
        {
            string userId = User.GetId();

            // Call data store
            var player = await _store.GetPlayerDetailsByUserIdAsync(userId);

            if (player == null)
            {
                return(Ok(new PlayerGetResponseModel {
                    Player = new PlayerGetResponseModel.PlayerEntry()
                }));
            }

            // Return result
            return(Ok(PlayerGetResponseModel.FromPlayer(player)));
        }
Example #3
0
        public async Task <ActionResult> GetCurrentPlayer()
        {
            string gamertag = User.GetGamerTag();

            if (string.IsNullOrWhiteSpace(gamertag))
            {
                return(NotFound());
            }

            // Call data store
            var player = await _store.GetPlayerDetailsByGamertagAsync(gamertag);

            if (player == null)
            {
                return(Ok(new PlayerGetResponseModel()));
            }

            // Return result
            return(Ok(PlayerGetResponseModel.FromPlayer(player)));
        }