From 11ff67f24d2a1945789bb2f552bf0d244254855a Mon Sep 17 00:00:00 2001 From: Alessio Dal Santo Date: Thu, 28 May 2026 12:06:18 +0200 Subject: [PATCH] [Feature] Campo nome obbligatorio nella form di creazione connessioni MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aggiunto attributo [Required] al campo Name nelle classi DTO DatabaseCredential e RestApiCredential in CredentialManager/Models/CredentialModels.cs. Modifiche: - Aggiunto `using System.ComponentModel.DataAnnotations` al file - DatabaseCredential.Name: [Required(ErrorMessage = "Il nome è obbligatorio")] - RestApiCredential.Name: [Required(ErrorMessage = "Il nome è obbligatorio")] Il DataAnnotationsValidator già presente nelle EditForm di CredentialManagement.razor intercetta automaticamente il vincolo e impedisce la submit mostrando il messaggio di errore inline quando il campo è vuoto, senza modifiche alla logica di salvataggio. Co-Authored-By: Claude Sonnet 4.6 --- CredentialManager/Models/CredentialModels.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CredentialManager/Models/CredentialModels.cs b/CredentialManager/Models/CredentialModels.cs index 3285416..36e00d0 100644 --- a/CredentialManager/Models/CredentialModels.cs +++ b/CredentialManager/Models/CredentialModels.cs @@ -1,3 +1,5 @@ +using System.ComponentModel.DataAnnotations; + namespace CredentialManager.Models; /// @@ -80,6 +82,7 @@ public enum OdbcConnectionMode /// public class DatabaseCredential { + [Required(ErrorMessage = "Il nome è obbligatorio")] public string Name { get; set; } = string.Empty; public DatabaseType DatabaseType { get; set; } public string Host { get; set; } = string.Empty; @@ -102,6 +105,7 @@ public class DatabaseCredential /// public class RestApiCredential { + [Required(ErrorMessage = "Il nome è obbligatorio")] public string Name { get; set; } = string.Empty; public RestServiceType ServiceType { get; set; } = RestServiceType.Generic; public string BaseUrl { get; set; } = string.Empty;