Ejemplo n.º 1
0
        public void deleteSubject(int id)
        {
            var db      = new TKBEntities();
            var subject = db.Tables.Find(id);

            db.Tables.Remove(subject);
            db.SaveChanges();
        }
Ejemplo n.º 2
0
        public void updateSubject(int id, string CaHoc, string thu2, string thu3, string thu4, string thu5, string thu6, string thu7)
        {
            var db             = new TKBEntities();
            var currentSubject = db.Tables.Find(id);

            currentSubject.Ca_Học          = CaHoc;
            currentSubject.Thứ_Hai         = thu2;
            currentSubject.Thứ_Ba          = thu3;
            currentSubject.Thứ_Tư          = thu4;
            currentSubject.Thứ_Năm         = thu5;
            currentSubject.Thứ_Sáu         = thu6;
            currentSubject.Thứ_Bảy         = thu7;
            db.Entry(currentSubject).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
Ejemplo n.º 3
0
        public void createSubject(string CaHoc, string thu2, string thu3, string thu4, string thu5, string thu6, string thu7)
        {
            var db         = new TKBEntities();
            var newSubject = new Table();

            newSubject.Ca_Học  = CaHoc;
            newSubject.Thứ_Hai = thu2;
            newSubject.Thứ_Ba  = thu3;
            newSubject.Thứ_Tư  = thu4;
            newSubject.Thứ_Năm = thu5;
            newSubject.Thứ_Sáu = thu6;
            newSubject.Thứ_Bảy = thu7;
            db.Tables.Add(newSubject);
            db.SaveChanges();
            db.Dispose();
        }