This commit is contained in:
Ajay Bhargav Baaskaran 2015-03-17 14:50:14 -07:00
parent 36a3262661
commit 68a125b9ce
1 changed files with 16 additions and 14 deletions

View File

@ -1,17 +1,5 @@
@model IEnumerable<MusicStore.Models.Album>
@helper Truncate(string input, int length)
{
if (input.Length <= length)
{
@input
}
else
{
@input.Substring(0, length)<text>...</text>
}
}
@{
ViewBag.Title = "Index";
}
@ -45,10 +33,24 @@
@Html.DisplayFor(modelItem => item.Genre.Name)
</td>
<td>
@Truncate(item.Artist.Name, 25)
@if (item.Artist.Name.Length <= 25)
{
@item.Artist.Name
}
else
{
@item.Artist.Name.Substring(0, 25)<text>...</text>
}
</td>
<td>
@Truncate(item.Title, 25)
if (item.Title.Length <= 25)
{
@item.Title
}
else
{
@item.Title.Substring(0, 25)<text>...</text>
}
</td>
<td>
@Html.DisplayFor(modelItem => item.Price)