Skip to content

Commit

Permalink
Added event specific homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
lambertwang-zz committed Oct 11, 2018
1 parent 0e86fa1 commit d62b175
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
8 changes: 8 additions & 0 deletions ServerCore/Pages/EventIndex.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@page "/{eventId}"
@model ServerCore.Pages.EventIndexModel
@{
ViewData["Title"] = "EventIndex";
}

<h2>@Model.Event.Name</h2>

18 changes: 18 additions & 0 deletions ServerCore/Pages/EventIndex.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using ServerCore.ModelBases;

namespace ServerCore.Pages
{
public class EventIndexModel : EventSpecificPageModel
{
public void OnGet()
{

}
}
}
4 changes: 3 additions & 1 deletion ServerCore/Pages/Events/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
@foreach (var item in Model.Events) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
<a asp-page="/EventIndex" asp-route-eventId="@item.ID">
@Html.DisplayFor(modelItem => item.Name)
</a>
</td>
<td>
@Html.DisplayFor(modelItem => item.UrlString)
Expand Down
13 changes: 12 additions & 1 deletion ServerCore/Pages/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,18 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a asp-page="/Index" class="navbar-brand">@(Event?.Name ?? "Microsoft Puzzles")</a>
@if (Event == null)
{
<a asp-page="/Index" class="navbar-brand">
Microsoft Puzzles
</a>
}
else
{
<a asp-page="/EventIndex" asp-route-eventId=@Event.ID class="navbar-brand">
@(Event.Name)
</a>
}
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
Expand Down

0 comments on commit d62b175

Please sign in to comment.