コード例 #1
0
        public IActionResult RegisterParticipant([FromBody] NewParticipant model)
        {
            logger.LogInformation($"#RegisterParticipant. {model?.Email}, {model?.Name}, {model?.EthAddress}, {model?.Avatar}");

            if (!ModelState.IsValid)
            {
                return(BadRequest(ErrorResult.GetResult(ModelState)));
            }

            var state = tournamentService.CheckNewParticipant(model);

            if (!state.IsSuccess)
            {
                return(BadRequest(ErrorResult.GetResult(state)));
            }

            var res = tournamentService.RegisterParticipant(model);

            if (!res.IsSuccess)
            {
                return(BadRequest(ErrorResult.GetResult(res)));
            }

            logger.LogInformation($"#RegisterParticipant. {model?.Email}: OK");
            return(Ok());
        }