Esempio n. 1
0
 public void Insert(T entity)
 {
     using (var db = new SALContext())
     {
         db.Entry(entity).State = System.Data.Entity.EntityState.Added;
         db.SaveChanges();
     }
 }
Esempio n. 2
0
 public void Delete(int id)
 {
     using (var db = new SALContext())
     {
         var entity = new T()
         {
             Id = id
         };
         db.Entry(entity).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
     }
 }