示例#1
0
 public void Add(T entity)
 {
     using (var db = new DatabaseDbEntities()) {
         entity.Id = db.Policy.Count() + 1;
         db.Entry(entity).State = System.Data.Entity.EntityState.Added;
         db.SaveChanges();
     };
 }
示例#2
0
 public void toUpdate(T entity)
 {
     using (var db = new DatabaseDbEntities())
     {
         db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     };
 }
示例#3
0
 public void Delete(int id)
 {
     using (var db = new DatabaseDbEntities())
     {
         var entidad = new T()
         {
             Id = id
         };
         db.Entry(entidad).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
     }
 }