From 9114e99bd5f5309dc1eae8fa5ca20a145b150fb7 Mon Sep 17 00:00:00 2001 From: Gianmarco Date: Tue, 2 Dec 2025 14:41:22 +0100 Subject: [PATCH] Confirm --- StandManager/Components/App.razor | 6 +- .../Components/Pages/Management/Utenti.razor | 62 ++++++++++++------- .../Pages/Management/Utenti_Edit.razor | 12 +++- StandManager/Model/UtenteViewModel.cs | 8 +-- 4 files changed, 57 insertions(+), 31 deletions(-) diff --git a/StandManager/Components/App.razor b/StandManager/Components/App.razor index f33df94..380d5b6 100644 --- a/StandManager/Components/App.razor +++ b/StandManager/Components/App.razor @@ -17,7 +17,7 @@ - + @@ -25,7 +25,9 @@
- + + + diff --git a/StandManager/Components/Pages/Management/Utenti.razor b/StandManager/Components/Pages/Management/Utenti.razor index f19855b..965767d 100644 --- a/StandManager/Components/Pages/Management/Utenti.razor +++ b/StandManager/Components/Pages/Management/Utenti.razor @@ -1,25 +1,29 @@ @attribute [Authorize] @page "/management/Utenti" + @rendermode InteractiveServer +@inject DialogService DialogService + Utenti
- - -
+
+ +
Overview
+

Utenti

+
+
@@ -36,12 +40,9 @@ - - - - - @@ -71,16 +72,29 @@ private async Task DeleteRow(Utente user) { - + var confirmationResult = await this.DialogService.Confirm("Are you sure?", "Dialog Title", new ConfirmOptions { OkButtonText = "Yes", CancelButtonText = "No" }); + if (confirmationResult == true) + { + //Delete logic for id + } + // var ok = await dialog.Confirm($"Vuoi davvero eliminare l'utente {user.ToString()}?", "Conferma eliminazione", new ConfirmOptions { OkButtonText = "Sì", CancelButtonText = "No", Width = "400px" }); + + // if (ok == true) + // { + // // qui fai l’eliminazione vera + // //ASP + // // se serve: + // await InvokeAsync(StateHasChanged); + // } } - private async Task SaveRow(Utente user) + RenderFragment GetMessage() { - - } - - private async Task CancelEdit(Utente user) - { - + return __builder => + { + + Are you sure? + + }; } } diff --git a/StandManager/Components/Pages/Management/Utenti_Edit.razor b/StandManager/Components/Pages/Management/Utenti_Edit.razor index d42121c..ae48bcc 100644 --- a/StandManager/Components/Pages/Management/Utenti_Edit.razor +++ b/StandManager/Components/Pages/Management/Utenti_Edit.razor @@ -59,7 +59,12 @@
-
+
+ +
+
@@ -117,4 +122,9 @@ await _managerService.UtenteService.Salva(model, Guid.Parse(idClaim)); _navManager.NavigateTo("/management/Utenti"); } + + private void backToHome() + { + _navManager.NavigateTo("/management/Utenti"); + } } diff --git a/StandManager/Model/UtenteViewModel.cs b/StandManager/Model/UtenteViewModel.cs index ec66d51..4744cfc 100644 --- a/StandManager/Model/UtenteViewModel.cs +++ b/StandManager/Model/UtenteViewModel.cs @@ -7,13 +7,13 @@ namespace StandManager.Model { public Guid Id { get; set; } public string Username { get; set; } - //[Required] - //[EmailAddress(ErrorMessage = "Email non valida")] + [Required] + [EmailAddress(ErrorMessage = "Email non valida")] public string Email { get; set; } public string Password { get; set; } - //[Required(ErrorMessage ="Il nome è obbligatorio")] + [Required(ErrorMessage = "Il nome è obbligatorio")] public string Nome { get; set; } - //[Required(ErrorMessage = "Il cognome è obbligatorio")] + [Required(ErrorMessage = "Il cognome è obbligatorio")] public string Cognome { get; set; } public static implicit operator UtenteViewModel(Utente? model)