Esempio n. 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();
     };
 }
Esempio n. 2
0
 public void toUpdate(T entity)
 {
     using (var db = new DatabaseDbEntities())
     {
         db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     };
 }
Esempio n. 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();
     }
 }