public bool Update(Produto entity) { var local = _context.Set <Produto>().Local.FirstOrDefault(e => e.Id == entity.Id); if (local != null) { _context.Entry(local).State = EntityState.Detached; } _context.Entry(entity).State = EntityState.Modified; try { _context.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { throw ex; } return(true); }
public bool Update(Usuario entity) { _context.Entry(entity).State = EntityState.Modified; try { _context.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { throw ex; } return(true); }