Skip to content

Instantly share code, notes, and snippets.

@nishanc
Created August 6, 2023 13:12
Show Gist options
  • Save nishanc/37dc09dce6b7f7b3ef66cc8901d64fd2 to your computer and use it in GitHub Desktop.
Save nishanc/37dc09dce6b7f7b3ef66cc8901d64fd2 to your computer and use it in GitHub Desktop.
var blogs = await context.Blogs.AsNoTracking().ToListAsync();
if (int.TryParse(ReadLine(), out var blogId))
{
Console.WriteLine("Posts:");
foreach (var post in blogs[blogId - 1].Posts)
{
Console.WriteLine($" {post.Title}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment