Files
SkyArtShop/Sky_Art_shop/Views/AdminBlog/Index.cshtml

44 lines
1.5 KiB
Plaintext
Raw Normal View History

@model List<SkyArtShop.Models.BlogPost>
@{
Layout = "~/Views/Shared/_AdminLayout.cshtml";
ViewData["Title"] = "Blog Posts";
}
<div class="card">
<div class="card-body d-flex justify-content-between align-items-center">
<h5 class="mb-0">Blog Posts</h5>
<a class="btn btn-primary" href="/admin/blog/create">Create Post</a>
</div>
</div>
<div class="card">
<div class="card-body">
<table class="table table-striped">
<thead>
<tr>
<th>Title</th>
<th>Slug</th>
<th>Published</th>
<th>Created</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach (var post in Model)
{
<tr>
<td>@post.Title</td>
<td>@post.Slug</td>
<td>@(post.IsPublished ? "Yes" : "No")</td>
<td>@post.CreatedAt.ToString("MMM dd, yyyy")</td>
<td>
<a class="btn btn-sm btn-secondary" href="/admin/blog/edit/@post.Id">Edit</a>
<form method="post" action="/admin/blog/delete/@post.Id" class="d-inline" onsubmit="return confirm('Delete this post?');">
<button class="btn btn-sm btn-danger" type="submit">Delete</button>
</form>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>