There is any difference between these cases where i use async/await
.
In the first case im awaiting for the service Task to complete and then return the value.
[HttpGet]
public async Task<IEnumerable<Post>> Get()
{
return await PostsService.GetAll(); // returns Task
}
In this case i return the Task
without awaiting for the data to be resolved.
[HttpGet]
public Task<IEnumerable<Post>> Get()
{
return PostsService.GetAll(); // returns Task
}
These two cases works without any errors. So im not sure if its correct to return directly without awaiting or there may be any issues.