I'm confused about C# async. I understand async for parallel task processing. For example, a method does A and B task, and async enables A and B do action in the same time; B doesn't have to wait until A be done.
But the below example code does only a single task which is pulling data from a database. It means, there is nothing for parallel tasks. But why does it use async?
Please give me an advice so that I can understand async.
[ResponseType(typeof(BookDetailDTO))]
public async Task<IHttpActionResult> GetBook(int id)
{
var book = await db.Books.Include(b => b.Author).Select(b =>
new BookDetailDTO()
{
Id = b.Id,
Title = b.Title,
Year = b.Year,
Price = b.Price,
AuthorName = b.Author.Name,
Genre = b.Genre
}).SingleOrDefaultAsync(b => b.Id == id);
if (book == null)
{
return NotFound();
}
return Ok(book);
}