Blackthorn

ViewPages

Nov 10th, 2014
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.60 KB | None | 0 0
  1. @using Resources;
  2. @model IEnumerable<JSSailing.Models.member>
  3.  
  4. @{
  5.     ViewBag.Title = JSTranslations.member_list;
  6.     int itemNumber = 0;
  7.     string previousPageURL = Url.Action("Index", new { page = Math.Max(((int)ViewBag.page) - 1, 1) });
  8.     string nextPageURL = Url.Action("Index", new { page = Math.Min(((int)ViewBag.page) + 1, (int)ViewBag.pageCount) });
  9.     if (ViewBag.pageCount > 1)
  10.     {
  11.         ViewBag.Title += String.Format(" ({0} / {1})", ViewBag.page, ViewBag.pageCount);
  12.     }
  13.     string buttonClasses = "btn btn-default";
  14.     string leftBttnClasses = "pull-left";
  15.     string rightBttnClasses = "pull-right";
  16.     if ((int)ViewBag.page == 1)
  17.     {
  18.         leftBttnClasses += " disabled";
  19.     }
  20.     if ((int)ViewBag.page == (int)ViewBag.pageCount)
  21.     {
  22.         rightBttnClasses += " disabled";
  23.     }
  24. }
  25.  
  26. <h2>@ViewBag.Title</h2>
  27. @if (ViewBag.pageCount > 1)
  28. {
  29.     <div>
  30.         <a href="@previousPageURL" class="@String.Format("{0} {1}", buttonClasses, leftBttnClasses)" accesskey="p">@JSTranslations.common_prevPage</a>
  31.         <a href="@nextPageURL" class="@String.Format("{0} {1}", buttonClasses, rightBttnClasses)" accesskey="n">@JSTranslations.common_nextPage</a>
  32.     </div>
  33. }
  34. @Html.ActionLink(JSTranslations.member_addNew, "Create", null, new { @class="pull-left", style="clear: both;" })
  35. <table class="table">
  36.     <tr>
  37.         <th>
  38.             @Html.DisplayNameFor(model => model.fullName)
  39.         </th>
  40.         <th>
  41.             @Html.DisplayNameFor(model => model.homePhone)
  42.         </th>
  43.         <th>
  44.             @Html.DisplayNameFor(model => model.email)
  45.         </th>
  46.         <th>
  47.             @Html.DisplayNameFor(model => model.yearJoined)
  48.         </th>
  49.         <th>
  50.             @Html.DisplayNameFor(model => model.comment)
  51.         </th>
  52.         <th></th>
  53.     </tr>
  54.  
  55. @foreach (var item in Model) {
  56.     <tr>
  57.         <td>
  58.             @Html.DisplayFor(modelItem => item.fullName)
  59.         </td>
  60.         <td>
  61.             @Html.DisplayFor(modelItem => item.homePhone)
  62.         </td>
  63.         <td>
  64.             @Html.DisplayFor(modelItem => item.email)
  65.         </td>
  66.         <td>
  67.             @Html.DisplayFor(modelItem => item.yearJoined)
  68.         </td>
  69.         <td>
  70.             @Html.DisplayFor(modelItem => item.comment)
  71.         </td>
  72.         <td>
  73.             @Html.ActionLink(JSTranslations.common_edit, "Edit", new { id=item.memberId }) |
  74.             @Html.ActionLink(JSTranslations.common_details, "Details", new { id=item.memberId }) |
  75.             @Html.ActionLink(JSTranslations.common_delete, "Delete", new { id=item.memberId })
  76.         </td>
  77.     </tr>
  78. }
  79.  
  80. </table>
Advertisement
Add Comment
Please, Sign In to add comment