public async Task <IActionResult> Login([FromBody] CredencialCommand command)
 {
     try
     {
         var resultRequired = new CredencialCommandContract(command);
         if (resultRequired.Invalid)
         {
             return(await Response(null, resultRequired.Notifications));
         }
         else
         {
             return(await Response(await _usuarioService.LoginUsuario(command.Email, command.Senha), null));
         }
     }
     catch (Exception ex)
     {
         return(await Response(null, new List <Notification>() { new Notification(MESSAGE_ERRO_LOGAR_USUARIO, ex.Message) }));
     }
 }
Exemple #2
0
        public async Task TestLogin()
        {
            ConnectionStrings.BancoDadosConnection = bancoDadosConnection;

            _repository = new UsuarioRepository();
            _service    = new UsuarioService(_repository);
            _appService = new UsuarioAppService(AutoMapperConfiguration.RegisterMappings().CreateMapper(), _service, _jswtService);
            _controller = new UsuarioController(_appService);

            var credencial = new CredencialCommand()
            {
                Email = "*****@*****.**",
                Senha = "bwdesouza"
            };

            var result = await _controller.Login(credencial);

            Assert.IsNotNull(result);
            Assert.IsTrue(true);
        }