public IActionResult Authenticate([FromBody] User user) { var foundUser = _userActions.Authenticate(user.UserName, user.Password); if (foundUser.User == null) { return(BadRequest("Username or password is incorrect.")); } foundUser.User.Role = user.Role; return(Ok(new { foundUser.User.Token, foundUser.User.UserName })); }
public async Task <ApiResponse> Authenticate([FromBody] Login userParam) { var response = await _userAction.Authenticate(userParam.UserName, userParam.Password); return(response); }