Exemplo n.º 1
0
 public IActionResult Register([FromBody] UserRegistrationInContract registrationInContract)
 {
     try
     {
         // create user
         _userService.Create(registrationInContract);
         return(Ok());
     }
     catch (InvalidOperationException ex)
     {
         // return error message if there was an exception
         return(BadRequest(new { message = ex.Message }));
     }
 }
Exemplo n.º 2
0
        public void Create(UserRegistrationInContract registrationInContract)
        {
            try
            {
                var user = _mapper.Map <User>(registrationInContract);
                user.Id    = Guid.NewGuid();
                user.Token = CreateJwtToken(user.Id);

                _repository.CreateUser(user);
            }
            catch (NotImplementedException ex)
            {
                _logger.Log(LogLevel.Error, ex.Message);
            }
        }