-
-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathDraftBlogPostPage.razor
More file actions
36 lines (30 loc) · 972 Bytes
/
Copy pathDraftBlogPostPage.razor
File metadata and controls
36 lines (30 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
@page "/draft"
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Infrastructure
@using LinkDotNet.Blog.Infrastructure.Persistence
@attribute [Authorize]
@inject IRepository<BlogPost> BlogPostRepository
<PageTitle>Drafts</PageTitle>
<div class="container">
<h3 class="fw-bold">Draft Blog Posts</h3>
<div class="content px-4">
@if (blogPosts.Count > 0)
{
@for (var i = 0; i < blogPosts.Count; i++)
{
<ShortBlogPost BlogPost="blogPosts[i]" UseAlternativeStyle="@(i % 2 != 0)"></ShortBlogPost>
}
}
else
{
<p>No draft blog posts currently. <a href="/create">Create a new blog post</a></p>
}
</div>
</div>
@code {
private IReadOnlyList<BlogPost> blogPosts = PagedList<BlogPost>.Empty;
protected override async Task OnInitializedAsync()
{
blogPosts = await BlogPostRepository.GetAllAsync(p => !p.IsPublished, b => b.UpdatedDate);
}
}