@model Project_Unite.Models.Contest @using Microsoft.AspNet.Identity @{ ViewBag.Title = "Contest: " + Model.Name; }

@Model.Name

@if (!string.IsNullOrWhiteSpace(Model.VideoId)) { } @if (Model.IsEnded) {

This contest has ended on @Model.EndsAt

} else {

This contest is open - and will be closed at @Model.EndsAt

}

@Html.Markdown(Model.Description)

Contest rewards:

Gold:
@Model.CodepointReward1st Codepoints
Silver:
@Model.CodepointReward2nd Codepoints
Bronze:
@Model.CodepointReward3rd Codepoints

Submissions

Below is a list of all submissions for this contest.

Submission
Actions
@if(Model.Entries.Length == 0) {

There are no submissions for this contest. Be the first!

} else { foreach(var c in Model.Entries) {
@Html.ActionLink(c.Name, "ViewSubmission", "Contests", new { id=c.Id}, null)

By @Html.UserLink(c.AuthorId) on @c.PostedAt • @c.Upvotes.Length • @c.Downvotes.Length

@if (c.Disqualified) {

This submission has been disqualified by @Html.UserLink(c.DisqualifiedBy) - Reason:
@c.DisqualifiedReason

}
@if (!string.IsNullOrWhiteSpace(c.VideoId)) { Watch video } @if (!string.IsNullOrWhiteSpace(c.DownloadURL)) { Download } @if (User.Identity.IsAdmin() && c.Disqualified == false) { @Html.ActionLink("Disqualify", "Disqualify", "Contests", new { id=c.Id}, new { @class="btn btn-danger"}) }
} }

Want to win this contest?

@if (!Model.UserSubmitted(User.Identity.GetUserId())) { if (Model.IsEnded) {

Unfortunately, this contest has ended and you cannot submit an entry. Perhaps there's another contest still going?

} else {

Good news! This contest is still open. Hurry and submit your entry!

Go, go, go! Submit an entry! } } else {

You have already submitted an entry for this contest.

}

Current winners:

@{ var toptobottom = Model.Entries.OrderByDescending(x => (x.Upvotes.Length - x.Downvotes.Length)); } @if(toptobottom.Count() >= 3) { var first = toptobottom.ToArray()[0]; var second = toptobottom.ToArray()[1]; var third = toptobottom.ToArray()[2];
First place:
@first.Name by @Html.UserLink(first.AuthorId)
Second place:
@second.Name by @Html.UserLink(second.AuthorId)
Third place:
@third.Name by @Html.UserLink(third.AuthorId)
} else {

Not enough people have entered into this contest.

}