Karan Thakkar

Karan Thakkar

  • 1.4k
  • 204
  • 86.4k

Async Await in asp.net core web api?

Aug 12 2019 5:15 AM
On first request method gets executed but on the second call it doesn't, I am aslo using await keyword?
 
The method which I am calling is not an async method?
 
When I debug the code user comes null once I logout and again login but by going inside the method with F11 user gets filled, can someone help me to understand this?
  1. public async Task<IActionResult> AuthenticateUser([FromBody] User user)  
  2. {  
  3. Login login = new Login();  
  4. user = await login.AuthenticateUser(user.LoginId, user.Password);  
  5. if (userDetails!=null)  
  6. {  
  7. return Ok(userDetails);  
  8. }  
  9. return BadRequest();  
  10. }  

Answers (4)