52 lines
2.2 KiB
Plaintext

@page
@model IndexModel
@{
ViewData["Title"] = "Song of the Day";
}
<div class="text-center">
<h1 class="display-4">Submission History</h1>
<table>
<tr>
<th>Date</th>
<th>Song</th>
<th>Submitter</th>
@if(@User.Identity.IsAuthenticated)
{
<th>Details</th>
<th></th>
}
</tr>
@foreach(var songSuggestion in Model.SongSuggestions)
{
@if(songSuggestion != null && songSuggestion.Song != null && songSuggestion.User != null && songSuggestion.UserHasSubmitted)
{
var displayName = string.IsNullOrEmpty(songSuggestion?.User?.NickName)
? songSuggestion?.User.Name
: songSuggestion.User.NickName;
<tr>
<td>@songSuggestion?.Date.ToString("dd. MM. yyyy")</td>
<td><a href="@songSuggestion?.Song.Url" target="_blank">@string.Format("{0} - {1}", songSuggestion?.Song.Name, songSuggestion?.Song.Artist)</a></td>
<td>@displayName</td>
@if(@User.Identity.IsAuthenticated)
{
<td><a href="/SongSubmission/@songSuggestion?.Id">View</a></td>
<td class="=viewLike">
@if(songSuggestion?.Song != null)
{
var handler = Model.HasUserLikedThisSong(@songSuggestion.Song) ? "UnlikeSong" : "LikeSong";
var likebuttonText = Model.HasUserLikedThisSong(@songSuggestion.Song) ? "Unlike" : "Like";
<form method="post">
<input name="songId" value="@songSuggestion.Song.SongId" type="hidden" />
<input type="submit" id="songlike" value="@likebuttonText" asp-page-handler="@handler" />
</form>
}
</td>
}
</tr>
}
}
</table>
</div>