blazor-calendar/BlazorApp/Pages/Event.razor

50 lines
982 B
Plaintext
Raw Normal View History

2021-07-03 12:19:53 +00:00
@page "/calendars/{calendarId:int}/events/{eventUid}"
@inject Data.CalendarService _calendarService
2021-07-04 11:38:52 +00:00
<a href="/calendars/@CalendarId">
<span class="oi oi-arrow-left"></span> Back
</a>
2021-07-03 12:19:53 +00:00
@if (_event == null)
{
<p>
<em>Loading...</em>
</p>
}
else
{
<h1>@_event.Summary</h1>
@if (_event.DtStart != null)
{
<div>
<strong>Start:</strong> @_event.DtStart
</div>
}
2021-07-04 12:36:21 +00:00
@if (_event.CalculatedEnd != null)
{
<div>
2021-07-04 12:36:21 +00:00
<strong>End:</strong> @_event.CalculatedEnd
</div>
}
2021-07-03 12:19:53 +00:00
<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);
}
}