blazor-calendar/BlazorApp/Pages/Event.razor

50 lines
982 B
Plaintext

@page "/calendars/{calendarId:int}/events/{eventUid}"
@inject Data.CalendarService _calendarService
<a href="/calendars/@CalendarId">
<span class="oi oi-arrow-left"></span> Back
</a>
@if (_event == null)
{
<p>
<em>Loading...</em>
</p>
}
else
{
<h1>@_event.Summary</h1>
@if (_event.DtStart != null)
{
<div>
<strong>Start:</strong> @_event.DtStart
</div>
}
@if (_event.CalculatedEnd != null)
{
<div>
<strong>End:</strong> @_event.CalculatedEnd
</div>
}
<p class="event-description">@_event.Description</p>
}
@code
{
[Parameter]
public int CalendarId { get; set; }
[Parameter]
public string EventUid { get; set; }
private Data.Event _event;
protected override async Task OnInitializedAsync()
{
var calendar = await Data.CalendarService.GetCalendarById(CalendarId);
_event = await calendar.GetEventByUid(EventUid);
}
}