public void EditarSetor(Setor setor) { if (_context.Setor.Any(x => x.Id != setor.Id)) { throw new NotFoundException("Id não encontrado"); } try { var obj = _context.Setor.Find(setor.Id); obj.Nome = setor.Nome; _context.Update(obj); _context.SaveChanges(); } catch (DbConcurrencyException e) { throw new DbConcurrencyException(e.Message); } }