public IActionResult Login(Users user) { if (string.IsNullOrEmpty(user.Username) || string.IsNullOrEmpty(user.Password)) { return(BadRequest()); } else { HttpStatusCode?result = _operations.LoginUser(user.Username, user.Password); if (result == HttpStatusCode.OK) { string encodedJwt = _token.GenerateToken(user); var response = new { access_token = encodedJwt, message = "success", HttpStatusCode.OK }; return(new JsonResult(response)); } else if (result == HttpStatusCode.NotFound) { return(NotFound()); } else if (result == HttpStatusCode.Unauthorized) { return(Unauthorized()); } else { return(Forbid()); } } }