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