Skip to content

Instantly share code, notes, and snippets.

@algorythm
Created June 4, 2019 07:09
Show Gist options
  • Select an option

  • Save algorythm/8e7b1846c19aeef3c53b8019700eb74a to your computer and use it in GitHub Desktop.

Select an option

Save algorythm/8e7b1846c19aeef3c53b8019700eb74a to your computer and use it in GitHub Desktop.
// ...
var userTask = _context.Users
.ByUserId(userId)
.FirstOrDefaultAsync();
var postTask = _context.SocialFeedPosts
.ByPostId(postId)
.FirstOrDefaultAsync();
await Task.WhenAll(userTask, postTask);
if (userTask.Result == null || postTask.Result == null)
{
return null;
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment