Пример #1
0
        public async Task <IActionResult> ChallengeStatus(int playerId)
        {
            var challengeStatus = await _challengeService.GetChallengeStatus(playerId);

            PlayerChallengeStatusGet pcStatus = new PlayerChallengeStatusGet()
            {
                ChallengeId  = challengeStatus.ChallengeId,
                ChallengerId = challengeStatus.ChallengerId,
                OpponentId   = challengeStatus.OpponentId,
                Status       = challengeStatus.Status
            };

            return(Ok(ApiHelper.ResponseWrapper(challengeStatus)));
        }
Пример #2
0
        public async Task <PlayerChallengeStatusGet> GetChallengeStatus(int playerId)
        {
            var pendingChallenge     = new PlayerChallengeStatusGet();
            var pendingChallengeData = await Task.Run(() => _ChallengeData.GetPendingChallengeByUser(playerId));

            if (pendingChallengeData != null)
            {
                pendingChallenge.ChallengeId  = pendingChallengeData.ChallengeId;
                pendingChallenge.OpponentId   = pendingChallengeData.OpponentPlayerId;
                pendingChallenge.ChallengerId = pendingChallengeData.ChallengingPlayerId;
                pendingChallenge.Status       = Enums.ChallengeStatus.Waiting;
            }

            return(pendingChallenge);
        }