コード例 #1
0
        public async Task <ActionResult <UserToken> > Register([FromBody] UserCreationDTO userCreationDTO)
        {
            var userRegister = await _accountsService.RegisterUserAsync(userCreationDTO);

            if (!userRegister.Succeeded)
            {
                foreach (var error in userRegister.Errors)
                {
                    ModelState.TryAddModelError(error.Code, error.Description);
                }
                return(BadRequest(ModelState));
            }

            return(await _accountsService.BuildToken(userCreationDTO.EmailAddress));
        }