public T RecuperarPorId(Guid id) { using (var db = new ClientesDbContext(_optionsBuilder)) { return(db.Set <T>().Find(id)); } }
public IList <T> Listar() { using (var db = new ClientesDbContext(_optionsBuilder)) { return(db.Set <T>().AsNoTracking().ToList()); } }
public void Excluir(T obj) { using (var db = new ClientesDbContext(_optionsBuilder)) { db.Set <T>().Remove(obj); db.SaveChanges(); } }
public void Atualizar(T obj) { using (var db = new ClientesDbContext(_optionsBuilder)) { db.Set <T>().Update(obj); db.SaveChanges(); } }
public void Adicionar(T obj) { using (var db = new ClientesDbContext(_optionsBuilder)) { db.Set <T>().Add(obj); db.SaveChanges(); } }
public void Adicionar(T obj) { using (var db = new ClientesDbContext(_optionsBuilder)) { try { db.Set <T>().Add(obj); db.SaveChanges(); } catch (Exception e) { Console.WriteLine(e.Message); } } }