SHA256
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:
@@ -4,7 +4,7 @@
|
||||
@using Somnia.GuestLog.Services;
|
||||
@using Microsoft.AspNetCore.WebUtilities;
|
||||
|
||||
@inject ISnackbar Snackbar
|
||||
@inject IUserMessageService userMessage
|
||||
@inject IDialogService DialogService
|
||||
@inject NavigationManager Navigation
|
||||
@inject IGuestDocumentService guestDocService
|
||||
@@ -92,7 +92,7 @@
|
||||
{
|
||||
if (docId is null)
|
||||
{
|
||||
Snackbar.Add("No GuestDocument provided!!", Severity.Error);
|
||||
userMessage.ShowMessage("No GuestDocument provided!!", MessageKind.Error);
|
||||
Navigation.NotFound();
|
||||
return;
|
||||
}
|
||||
@@ -100,7 +100,7 @@
|
||||
GuestDocIdDTO? docIdModel = GuestDocIdDTO.DecodeFromString(docId);
|
||||
if (docIdModel is null)
|
||||
{
|
||||
Snackbar.Add($"Provided GuestDocId can't be decoded: '{docId}'", Severity.Error);
|
||||
userMessage.ShowMessage($"Provided GuestDocId can't be decoded: '{docId}'", MessageKind.Error);
|
||||
Navigation.NotFound();
|
||||
return;
|
||||
}
|
||||
@@ -109,7 +109,7 @@
|
||||
documentModel = await guestDocService.GetDtoByIdAsync(docIdModel.DocumentType, docIdModel.DocumentNum);
|
||||
if (documentModel is null)
|
||||
{
|
||||
Snackbar.Add($"GuestDocument not found with ID: '{docId}'", Severity.Error);
|
||||
userMessage.ShowMessage($"GuestDocument not found with ID: '{docId}'", MessageKind.Error);
|
||||
Navigation.NotFound();
|
||||
return;
|
||||
}
|
||||
@@ -138,7 +138,7 @@
|
||||
|
||||
private void BtnEdit()
|
||||
{
|
||||
Snackbar.Add("Not implemented yet!", Severity.Info);
|
||||
userMessage.ShowMessage("Not implemented yet!", MessageKind.Info);
|
||||
}
|
||||
|
||||
private void BtnReturn()
|
||||
|
||||
Reference in New Issue
Block a user