public bool Delete(int Id) { var contexto = _context.Contextos.Where(c => c.Id == Id).FirstOrDefault(); if (contexto == null) { throw new NaoEncontradoException(); } _context.Entry(contexto).State = EntityState.Deleted; return(_context.SaveChanges() > 0); }
public bool Delete(int Id) { var contexto = GetById(Id); if (contexto == null) { throw new NaoEncontradoException(); } _context.Entry(contexto).State = EntityState.Deleted; return(_context.SaveChanges() > 0); }