Aggiunta cancellazione ispezione
This commit is contained in:
@@ -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 &&
|
||||
|
||||
Reference in New Issue
Block a user