GuestLog - User message improvements

- Added UserMessageService to have common methods for showing messages and errors to the user.
- Added Result record so services can return status on operation error (so it can be shown in the UI messages).
- Updated services to use the new Result record.
- Updated pages to use the new IUserMessageService.
This commit is contained in:
Daniel-Garmig committed 2026-08-23 21:57:26 +02:00
1 parent 0de4e1ba10
commit 511bd023f2
22 files changed
+239 -80

No files matched your search

@@ -7,7 +7,7 @@
@inject IDataListService dataListService;
@inject IValidator<StayEntryDTO> stayValidator;
@inject IDialogService dialogService;
@inject ISnackbar snackbar
@inject IUserMessageService userMessage
<MudForm @ref="@_form" Model="@Model" Validation="@((stayValidator as StayEntryDTOValidator)!.ValidateValue)"
@@ -149,7 +149,7 @@
if (Model.GuestDocuments is null || Model.GuestDocuments.Count == 0)
{
snackbar.Add("At least 1 guest is required!", MudBlazor.Severity.Warning);
userMessage.ShowMessage("At least 1 guest is required!", MessageKind.Warning);
return false;
}
@@ -205,7 +205,7 @@
if (resultData is null)
{
snackbar.Add("Error! No Guest Document selected!", MudBlazor.Severity.Error);
userMessage.ShowMessage("Error! No Guest Document selected!", MessageKind.Error);
return;
}
@@ -216,7 +216,7 @@
&& e.DocumentNum == resultData.DocumentNum);
if (alreadyAdded)
{
snackbar.Add("GuestDocument already added!", MudBlazor.Severity.Warning);
userMessage.ShowMessage("GuestDocument already added!", MessageKind.Warning);
return;
}
}