public ActionResult <UserModel> Login([FromBody] UserModel userModel)
        {
            var user = authRepo.Authenticate(userModel.emailId, userModel.password);

            if (user != null)
            {
                return(Ok(user));
            }
            return(NotFound("not found any user"));
        }
Exemple #2
0
        public IActionResult Post([FromBody] UserDto login)
        {
            IActionResult response = Unauthorized();

            var user = _authRepo.Authenticate(login);

            if (user != null)
            {
                var tokenString = _tokenRepo.createToken(user);
                response = Ok(new { token = tokenString });
            }

            return(response);
        }
 public AuthResult Token([FromBody] LoginModel credentials)
 {
     return(_repo.Authenticate(credentials));
 }