public IHttpActionResult Create(UserDto userDto) { var user = _mapper.Map <UserDto, Entity.User>(userDto); var userCreated = _usersDomain.Create(user); var userDtoCreated = _mapper.Map <Entity.User, UserDto>(userCreated); return(Created <UserDto>(Request.RequestUri + userDtoCreated.Id.ToString(), userDtoCreated)); }
public IActionResult Create([FromBody] SignInDto dto) { try { UserDto userDto = _usersDomain.Create(dto); userDto = _jwtAuth.GenerateToken(userDto); return(Ok(userDto)); } catch (ShakerDomainException ex) { return(BadRequest(new { message = ex.Message })); } catch (Exception ex) { _logger.LogCritical(ex.Message); return(BadRequest(new { message = MessagesGetter.Get(ErrorPresentationMessages.DefaultErrorMessage) })); } }