Last active
August 29, 2015 14:21
-
-
Save pielegacy/84b4bc4948fb67573b5a to your computer and use it in GitHub Desktop.
For Talfies <3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="quotes-container"> | |
@{ | |
var items = Model.ToList(); //Getting Database Model and converting it to a list for easy operations | |
int maxpage = items.Count / 26; //Finding the max page (int floors the decimal place which helps) | |
int startpoint = items.Count() - 1; | |
if (page > 1) | |
{ | |
startpoint -= 26 * (page - 1); | |
} | |
for (var i = startpoint; i >= items.Count() - 26 * page && i > 0; i--) //Basic For Loop printing the quotes to screen | |
{ | |
<div class="quote-element"> | |
<a class="enter-quote" href="/Quotes/Details/@items[i].QuoteId"><i><h2>"@Html.DisplayFor(modelItem => items[i].QuoteText)"</h2></i></a> | |
<p>- @Html.DisplayFor(modelItem => items[i].QuoteAuthor) , <a href="/Quotes/Topics/@items[i].TopicId">Part of @Html.DisplayFor(modelItem => items[i].Topic.TopicName)</a></p> | |
</div> | |
} | |
} | |
</div> | |
<div class="text-center"> | |
<strong>Page</strong><br /> | |
@{ | |
if (page > 1) | |
{ | |
@Html.ActionLink("<", "Index", new { p = page - 1 }, new { @class = "paginate" }); | |
} | |
<strong class ="paginate">@page</strong> | |
if (page <= maxpage) { | |
@Html.ActionLink(">", "Index", new { p = page + 1 }, new { @class = "paginate" }); | |
} | |
} | |
<br /> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment