public IActionResult Authenticate([FromBody] AuthenticateModel model) { var user = _userService.Authenticate(model.Username, model.Password); if (user == null) { return(BadRequest(new { message = "Username or password is incorrect" })); } return(Ok(user)); }
public IActionResult Authenticate([FromBody] LoginModel login) { var user = _userService.Authenticate(login); return(user.Status switch { LoginStatus.Success => Ok(new { success = true, user }), _ => BadRequest(new { success = false, user }), });