public void Create(ThoiKhoaBieu tkb) { using (var context = new QuanLyDaoTaoEntities()) { context.ThoiKhoaBieux.Add(tkb); context.SaveChanges(); } }
public void Delete(ThoiKhoaBieu tkb) { using (var context = new QuanLyDaoTaoEntities()) { ThoiKhoaBieu thoiKhoaBieu = context.ThoiKhoaBieux.Where(x => x.Ngay == tkb.Ngay && x.Buoi == tkb.Buoi && x.MaLopTC == tkb.MaLopTC).FirstOrDefault(); context.ThoiKhoaBieux.Remove(thoiKhoaBieu); context.SaveChanges(); } }
public void Edit(ThoiKhoaBieu tkb) { using (var context = new QuanLyDaoTaoEntities()) { var query = context.ThoiKhoaBieux.Where(x => x.Ngay == tkb.Ngay && x.Buoi == tkb.Buoi && x.MaLopTC == tkb.MaLopTC).FirstOrDefault(); context.Entry(query).CurrentValues.SetValues(tkb); context.SaveChanges(); } }