Exemplo n.º 1
0
        public IActionResult Register([FromBody] UserView userView)
        {
            // map dto to entity
            var user = _mapper.Map <User>(userView);

            try
            {
                // save
                _userService.RepositoryUser.Create(user, userView.Password);
                _userService.Commit();
                return(Ok());
            }
            catch (AppException ex)
            {
                // return error message if there was an exception
                return(BadRequest(new { message = ex.Message }));
            }
        }