From 5f452c026e2525213090619f509950e08411045a Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Sun, 4 Jul 2021 13:39:11 +0200 Subject: [PATCH] Check for null parameters in the interface --- BlazorApp/Pages/Calendar.razor | 28 ++++++++++++++++++---------- BlazorApp/Pages/Event.razor | 21 +++++++++++++++------ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/BlazorApp/Pages/Calendar.razor b/BlazorApp/Pages/Calendar.razor index 331127f..ff79110 100644 --- a/BlazorApp/Pages/Calendar.razor +++ b/BlazorApp/Pages/Calendar.razor @@ -14,20 +14,28 @@ else {

Calendar "@_calendar.Name"

- @foreach (var e in _events) + @foreach (var @event in _events) {
- -

@e.Summary

+
+

@(@event.Summary)

-
- Start: @e.DtStart -
-
- End: @e.DtEnd -
-
@e.Description
+ @if (@event.DtStart != null) + { +
+ Start: @(@event.DtStart) +
+ } + + @if (@event.DtEnd != null) + { +
+ End: @(@event.DtEnd) +
+ } + +
@(@event.Description)
} } diff --git a/BlazorApp/Pages/Event.razor b/BlazorApp/Pages/Event.razor index 256ecea..3782c1e 100644 --- a/BlazorApp/Pages/Event.razor +++ b/BlazorApp/Pages/Event.razor @@ -14,12 +14,21 @@ else {

@_event.Summary

-
- Start: @_event.DtStart -
-
- End: @_event.DtEnd -
+ + @if (_event.DtStart != null) + { +
+ Start: @_event.DtStart +
+ } + + @if (_event.DtEnd != null) + { +
+ End: @_event.DtEnd +
+ } +

@_event.Description

}