Aggiunta cancellazione ispezione

This commit is contained in:
2026-04-23 11:22:13 +02:00
parent c2da0e150d
commit f09ea026bc
3 changed files with 27 additions and 3 deletions

View File

@@ -117,6 +117,10 @@ public class IspezioniService(AppDbContext db) : IIspezioniService
/// </summary>
public async Task<bool> 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 &&