public async Task <IActionResult> Cadastrar([FromBody] CreateConsumidorCommand command, [FromServices] AuthService authService)
        {
            var(success, message, result) = await authService.Register(command);

            if (!success)
            {
                return(BadRequest(new FailViewModel(message)));
            }

            return(Ok(result));
        }
Beispiel #2
0
 public Task <(bool success, string message, AuthenticationResult result)> Register(CreateConsumidorCommand source)
 {
     return(RegisterUser(new Usuario()
     {
         Email = source.Email,
         Tipo = source.TipoVinculo,
         Nome = source.Nome,
         PhoneNumber = source.Telefone,
         UserName = source.Email ?? source.Telefone,
         Consumidor = new Consumidor
         {
             Id = Guid.NewGuid(),
             CidadePadraoId = source.CidadePadraoId
         }
     }, source.Senha));
 }