PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms 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
 3@helper Truncate(string input, int length)
 4{
 5    if (input.Length <= length) {
 6        @input
 7    } else {
 8        @input.Substring(0, length)<text>...</text>
 9    }
10}
11
12@{
13    ViewBag.Title = "Index";
14}
15
16<h2>Index</h2>
17
18<p>
19    @Html.ActionLink("Create New", "Create")
20</p>
21<table>
22    <tr>
23        <th>
24            Genre
25        </th>
26        <th>
27            Artist
28        </th>
29        <th>
30            Title
31        </th>
32        <th>
33            Price
34        </th>
35        <th></th>
36    </tr>
37
38@foreach (var item in Model) {
39    <tr>
40        <td>
41            @Html.DisplayFor(modelItem => item.Genre.Name)
42        </td>
43        <td>
44            @Truncate(item.Artist.Name, 25)
45        </td>
46        <td>
47            @Truncate(item.Title, 25)
48        </td>
49        <td>
50            @Html.DisplayFor(modelItem => item.Price)
51        </td>
52        <td>
53            @Html.ActionLink("Edit", "Edit", new { id=item.AlbumId }) |
54            @Html.ActionLink("Details", "Details", new { id=item.AlbumId }) |
55            @Html.ActionLink("Delete", "Delete", new { id=item.AlbumId })
56        </td>
57    </tr>
58}
59
60</table>