示例#1
0
        public async Task <dynamic> RegisterUserAsync([FromBody] RegisterUser model)
        {
            try
            {
                var user = await _userAuthenticate.RegisterAsync(model);

                var token = TokenService.GenerateToken(user);

                return(Ok(new
                {
                    user = user,
                    token = token
                }));
            }
            catch (AppException e)
            {
                return(BadRequest(e.Message));
            }
            catch (Exception e)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
            }
        }