public ActionResult <User> Login([FromBody] User model) { try { var service = new UsuarioRepository(_configuration); var user = service.Authenticate(model); if (user == null) { return(BadRequest(new { message = "Usuário ou senha inválidos" })); } return(Ok(user)); } catch (Exception ex) { return(BadRequest(ex)); } }
public async Task <UsuarioDTO> Authenticate(string email, string password) { return(await repository.Authenticate(email, password)); }