PageRenderTime 41ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/MvcMusicStore/Views/StoreManager/Index.cshtml

#
Razor | 60 lines | 54 code | 6 blank | 0 comment | 2 complexity | 3eaa2207aa9fad411c8f7d4cb050f9e2 MD5 | raw file
  1. @model IEnumerable<MvcMusicStore.Models.Album>
  2. @helper Truncate(string input, int length)
  3. {
  4. if (input.Length <= length) {
  5. @input
  6. } else {
  7. @input.Substring(0, length)<text>...</text>
  8. }
  9. }
  10. @{
  11. ViewBag.Title = "Index";
  12. }
  13. <h2>Index</h2>
  14. <p>
  15. @Html.ActionLink("Create New", "Create")
  16. </p>
  17. <table>
  18. <tr>
  19. <th>
  20. Genre
  21. </th>
  22. <th>
  23. Artist
  24. </th>
  25. <th>
  26. Title
  27. </th>
  28. <th>
  29. Price
  30. </th>
  31. <th></th>
  32. </tr>
  33. @foreach (var item in Model) {
  34. <tr>
  35. <td>
  36. @Html.DisplayFor(modelItem => item.Genre.Name)
  37. </td>
  38. <td>
  39. @Truncate(item.Artist.Name, 25)
  40. </td>
  41. <td>
  42. @Truncate(item.Title, 25)
  43. </td>
  44. <td>
  45. @Html.DisplayFor(modelItem => item.Price)
  46. </td>
  47. <td>
  48. @Html.ActionLink("Edit", "Edit", new { id=item.AlbumId }) |
  49. @Html.ActionLink("Details", "Details", new { id=item.AlbumId }) |
  50. @Html.ActionLink("Delete", "Delete", new { id=item.AlbumId })
  51. </td>
  52. </tr>
  53. }
  54. </table>