First cut of admin dashboard

Add web log details to common model
This commit is contained in:
2022-02-27 20:01:53 -05:00
parent 39e0d5ec8b
commit 8f94d7ddfe
21 changed files with 390 additions and 41 deletions

View File

@@ -12,8 +12,12 @@ public class AdminController : MyWebLogController
public AdminController(WebLogDbContext db) : base(db) { }
[HttpGet("")]
public IActionResult Index()
{
return View();
}
public async Task<IActionResult> Index() =>
View(new DashboardModel(WebLog)
{
Posts = await Db.Posts.CountByStatus(PostStatus.Published),
Drafts = await Db.Posts.CountByStatus(PostStatus.Draft),
Pages = await Db.Pages.CountAll(),
Categories = await Db.Categories.CountAll()
});
}