예제 #1
0
        public void Insert(T obj)
        {
            CrystelContext con = new CrystelContext();

            con.Set <T>().Add(obj);
            con.SaveChanges();
        }
예제 #2
0
        public void Update(T obj)
        {
            CrystelContext con = new CrystelContext();

            con.Set <T>().Attach(obj);
            con.Entry(obj).State = EntityState.Modified;
            con.SaveChanges();
        }
예제 #3
0
        public void Delete(object id)
        {
            CrystelContext con = new CrystelContext();
            T del = con.Set <T>().Find(id);

            con.Set <T>().Remove(del);
            con.SaveChanges();
        }