Exemple #1
0
        public ActionResult ChallengePlayer([FromRoute] int opponentId, [FromBody] PlayerChallengeReqModel challengeData)
        {
            challengeData.OpponentId = opponentId;

            var result = _playerService.ChallengePlayer(challengeData);

            if (result.Data == null)
            {
                //It would be better 204 No Content, 404 is for missing endpoint
                return(NotFound(result.Error));
            }

            return(Created(new Uri($"/game/{result.Data.GameId.ToString()}", UriKind.Relative), result.Data));
        }