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