From 6359645c05d99dc7542ed7bc0e64bc4e7c62cef9 Mon Sep 17 00:00:00 2001 From: rbleattler Date: Sun, 10 Nov 2019 12:34:02 -0500 Subject: [PATCH 1/2] Added the pagecount variable which calculates the total number of pages. When the current page is the last ACTUAL page, the Previous (older) button will no longer show up, and take the user to an empty page. --- src/Views/Blog/Index.cshtml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Views/Blog/Index.cshtml b/src/Views/Blog/Index.cshtml index 78068335..09463adc 100644 --- a/src/Views/Blog/Index.cshtml +++ b/src/Views/Blog/Index.cshtml @@ -2,6 +2,7 @@ @inject IOptionsSnapshot settings @{ int currentPage = int.Parse(ViewContext.RouteData.Values["page"] as string ?? "0"); + int pageCount = Model.ToList().Count-1; } @foreach (var post in Model) @@ -10,7 +11,7 @@ }