From f09ea026bca6ad69b7daab246ececed6f2269d84 Mon Sep 17 00:00:00 2001 From: MarcoE Date: Thu, 23 Apr 2026 11:22:13 +0200 Subject: [PATCH] Aggiunta cancellazione ispezione --- .../EntityServices/IspezioniService.cs | 4 ++++ .../Components/Layout/HeaderLayout.razor | 3 +-- SteUp.Shared/Components/Layout/NavMenu.razor | 23 ++++++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/SteUp.Data/LocalDb/EntityServices/IspezioniService.cs b/SteUp.Data/LocalDb/EntityServices/IspezioniService.cs index 229fc91..b5dbbb2 100644 --- a/SteUp.Data/LocalDb/EntityServices/IspezioniService.cs +++ b/SteUp.Data/LocalDb/EntityServices/IspezioniService.cs @@ -117,6 +117,10 @@ public class IspezioniService(AppDbContext db) : IIspezioniService /// public async Task DeleteIspezioneAsync(string codMdep, DateTime data, string rilevatore) { + var schede = await GetAllSchedeOfIspezioneAsync(codMdep, data, rilevatore); + if (schede.Count > 0) + throw new Exception("Impossibile cancellare l'ispezione perché ci sono schede collegate. Cancellare prima le schede."); + var ispezione = await db.Ispezioni .FirstOrDefaultAsync(x => x.CodMdep == codMdep && diff --git a/SteUp.Shared/Components/Layout/HeaderLayout.razor b/SteUp.Shared/Components/Layout/HeaderLayout.razor index aa69175..fd5ea3d 100644 --- a/SteUp.Shared/Components/Layout/HeaderLayout.razor +++ b/SteUp.Shared/Components/Layout/HeaderLayout.razor @@ -1,5 +1,4 @@ -@using SteUp.Shared.Core.Helpers -@inject IJSRuntime Js +@inject IJSRuntime Js
diff --git a/SteUp.Shared/Components/Layout/NavMenu.razor b/SteUp.Shared/Components/Layout/NavMenu.razor index 0865a3e..e4a7f05 100644 --- a/SteUp.Shared/Components/Layout/NavMenu.razor +++ b/SteUp.Shared/Components/Layout/NavMenu.razor @@ -1,11 +1,14 @@ @using CommunityToolkit.Mvvm.Messaging @using SteUp.Shared.Components.SingleElements.MessageBox @using SteUp.Shared.Core.Enum +@using SteUp.Shared.Core.Interface.LocalDb @using SteUp.Shared.Core.Messages.Ispezione @using SteUp.Shared.Core.Messages.Scheda @inject INetworkService NetworkService @inject IDialogService Dialog @inject IMessenger Messenger +@inject IIspezioniService IspezioniService +@inject IJSRuntime Js
@@ -42,6 +45,9 @@ + + if (ShowCompleteInspection) {