public async Task <bool> EliminaModulo(Modulo modulo) { bool result = false; Esame e = await _db.Esami.FirstOrDefaultAsync(x => x.IdModulo == modulo.Id); if (e == null) { _db.Moduli.Remove(_db.Moduli.First(x => x.Id == modulo.Id)); await _db.SaveChangesAsync(); result = true; } return(result); }
public async Task <bool> EliminaIscrizione(int id) { bool result = false; Esame e = await _db.Esami.FirstOrDefaultAsync(x => x.IdStudenteIscritto == id); if (e == null) { StudenteIscritto s = await _db.StudentiIscritti.FindAsync(id); _db.StudentiIscritti.Remove(s); await _db.SaveChangesAsync(); result = true; } return(result); }