コード例 #1
0
 public virtual void Remove(int id)
 {
     using (var contexto = new RedeComercialContext())
     {
         contexto.Set <T>().Remove(contexto.Set <T>().Find(id));
         contexto.SaveChanges();
     }
 }
コード例 #2
0
 public virtual T Busca(int id)
 {
     using (var contexto = new RedeComercialContext())
     {
         return(contexto.Set <T>().Find(id));
     }
 }
コード例 #3
0
 public virtual IList <T> Lista()
 {
     using (var contexto = new RedeComercialContext())
     {
         return(contexto.Set <T>().ToList());
     }
 }
コード例 #4
0
 public virtual void Adiciona(T modelo)
 {
     using (var contexto = new RedeComercialContext())
     {
         contexto.Set <T>().Add(modelo);
         contexto.SaveChanges();
     }
 }