public T Atualizar(T modelo) { using (var db = new CodeFirstDBContext()) { db.ChangeTracker.AutoDetectChangesEnabled = false; db.Entry(modelo).State = EntityState.Modified; db.SaveChanges(); return(modelo); } }
public T Inserir(T modelo) { using (var db = new CodeFirstDBContext()) { db.ChangeTracker.AutoDetectChangesEnabled = false; AtualizarValoresPadroes(modelo); db.Set <T>().Add(modelo); db.SaveChanges(); return(modelo); } }