public async Task <UserDTO> Create(UserDTO userDTO) { var userExists = await _userRepository.GetByEmail(userDTO.Email); if (userExists != null) { throw new DomainException("Já existe um usuário cadastrado com o email informado."); } var user = _mapper.Map <User>(userDTO); user.Validate(); user.ChangePassword(_rijndaelCryptography.Encrypt(userDTO.Password)); var userCreated = await _userRepository.Create(user); return(_mapper.Map <UserDTO>(userCreated)); }
public IActionResult Encrypt([FromBody] string text) { try { return(Ok(_rijndaelCryptography.Encrypt(text))); } catch (Exception e) { return(StatusCode(500, new { message = e.Message })); } }
public string Encrypt(string text) { try { return(_rijndaelCryptography.Encrypt(text)); } catch (Exception ex) { throw; //Create a CryptographyException } }
public string Encrypt(string value) { return(_cryptography.Encrypt(value)); }