Пример #1
0
 public void Update(ITSupporter s)
 {
     using (var db = new ODTS_DBEntities())
     {
         db.Entry(s).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
 public void Create(T entity)
 {
     using (var db = new ODTS_DBEntities())
     {
         db.Set <T>().Add(entity);
         db.SaveChanges();
     }
 }
Пример #3
0
 public void Add(RequestHistory s)
 {
     using (var db = new ODTS_DBEntities())
     {
         db.Entry(s).State = System.Data.Entity.EntityState.Added;
         db.SaveChanges();
     }
 }
        public void Delete(int id)
        {
            using (var db = new ODTS_DBEntities())
            {
                var entity = db.Set <T>().Find(id);
                if (entity != null)
                {
                    db.Set <T>().Remove(entity);
                }

                db.SaveChanges();
            }
        }