blazor-calendar/BlazorApp/Pages/Event.razor

37 lines
763 B
Plaintext

@page "/calendars/{calendarId:int}/events/{eventUid}"
@inject Data.CalendarService _calendarService
@if (_event == null)
{
<p>
<em>Loading...</em>
</p>
}
else
{
<h1>@_event.Summary</h1>
<div>
<strong>Start:</strong> @_event.DtStart
</div>
<div>
<strong>End:</strong> @_event.DtEnd
</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);
}
}