What is actually returned by a Web API method with the following signature?
[HttpPost]
public async Task<IHttpActionResult> Post([FromBody] ReviewViewModel review)
{
using (var context = new BooksContext())
{
var book = await context.Books.FirstOrDefaultAsync(b => b.Id == review.BookId);
if (book == null)
{
return NotFound();
}
var newReview = context.Reviews.Add(new Review
{
BookId = book.Id,
Description = review.Description,
Rating = review.Rating
});
await context.SaveChangesAsync();
return Ok(new ReviewViewModel(newReview));
}
}
Method taken from: http://www.developerhandbook.com/c-sharp/create-restful-api-authentication-using-web-api-jwt/
I'm considering that it is either:
1) The framework does not return a response to the calling client until .IsCompleted is true, or 2) The framework does return to the client but the client must handle the situation gracefully, or 3) Something else entirely.