Ejemplo n.º 1
0
        public async Task <IActionResult> Register([FromBody] UserRegisterRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var userDto = await _usersService.CreateEntityAsync(request);

            var token = _tokensService.CreateTokenDto(userDto);

            if (token == null)
            {
                return(StatusCode(500, "Internal Server Error"));
            }

            return(Ok(token));
        }