|
44 | 44 | </div>
|
45 | 45 |
|
46 | 46 | @code {
|
47 |
| -private IReadOnlyCollection<IGrouping<int, BlogPostPerYear>> blogPostsPerYear; |
48 |
| -private int blogPostCount; |
| 47 | + private IReadOnlyCollection<IGrouping<int, BlogPostPerYear>> blogPostsPerYear; |
| 48 | + private int blogPostCount; |
49 | 49 |
|
50 |
| -protected override async Task OnInitializedAsync() |
51 |
| -{ |
52 |
| -var blogPosts = await Repository.GetAllByProjectionAsync( |
53 |
| -p => new BlogPostPerYear(p.Id, p.Slug, p.Title, p.UpdatedDate), |
54 |
| -p => p.IsPublished); |
55 |
| -blogPostCount = blogPosts.Count; |
56 |
| -blogPostsPerYear = blogPosts |
57 |
| -.GroupBy(r => r.UpdatedDate.Year) |
58 |
| -.OrderByDescending(r => r.Key) |
59 |
| -.ToImmutableArray(); |
60 |
| -} |
| 50 | + protected override async Task OnInitializedAsync() |
| 51 | + { |
| 52 | + var blogPosts = await Repository.GetAllByProjectionAsync( |
| 53 | + p => new BlogPostPerYear(p.Id, p.Slug, p.Title, p.UpdatedDate), |
| 54 | + p => p.IsPublished); |
| 55 | + blogPostCount = blogPosts.Count; |
| 56 | + blogPostsPerYear = blogPosts |
| 57 | + .GroupBy(r => r.UpdatedDate.Year) |
| 58 | + .OrderByDescending(r => r.Key) |
| 59 | + .ToImmutableArray(); |
| 60 | + } |
61 | 61 |
|
62 |
| -private sealed record BlogPostPerYear(string Id, string Slug, string Title, DateTime UpdatedDate); |
| 62 | + private sealed record BlogPostPerYear(string Id, string Slug, string Title, DateTime UpdatedDate); |
63 | 63 | }
|
0 commit comments