예제 #1
0
        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));
            }
        }
예제 #2
0
 public async Task <UsuarioDTO> Authenticate(string email, string password)
 {
     return(await repository.Authenticate(email, password));
 }