@page "/calendars/{calendarId:int}/events/{eventUid}" @inject Data.CalendarService _calendarService @inject NavigationManager _navigationManager Back @if (_event == null) {

@(_notFound ? "Event not found" : "Loading...")

} else { @if (!_editTitle) {

@_event.Summary

} else { }
ETag: @_event.ETag
@if (_event.DtStart != null) {
Start: @_event.DtStart
} @if (_event.CalculatedEnd != null) {
End: @_event.CalculatedEnd
} @if (_event.Description != null) {

@_event.Description

} @if (!_confirmDelete) { } else { } } @code { [Parameter] public int CalendarId { get; set; } [Parameter] public string EventUid { get; set; } private Data.Calendar _calendar; private Data.Event _event; private bool _notFound; private bool _editTitle; private bool _confirmDelete; protected override async Task OnInitializedAsync() { _calendar = await Data.CalendarService.GetCalendarById(CalendarId); _event = await _calendar.GetEventByUid(EventUid); _notFound = _event == null; } private async Task UpdateEvent() { _event = await _calendar.UpdateEvent(_event); } private async Task DeleteEvent() { if (!_confirmDelete) { _confirmDelete = true; await Task.Delay(2000); } else { await _calendar.DeleteEvent(_event); _navigationManager.NavigateTo($"/calendars/{CalendarId}"); } _confirmDelete = false; } }