public void Create(HeDaoTao hdt) { using (var context = new QuanLyDaoTaoEntities()) { context.HeDaoTaos.Add(hdt); context.SaveChanges(); } }
public HeDaoTao GetById(string id) { using (var context = new QuanLyDaoTaoEntities()) { HeDaoTao hdt = context.HeDaoTaos.Find(id); return(hdt); } }
public void Delete(string maHDT) { using (var context = new QuanLyDaoTaoEntities()) { HeDaoTao hdt = context.HeDaoTaos.Find(maHDT); context.HeDaoTaos.Remove(hdt); context.SaveChanges(); } }
public void Edit(HeDaoTao hdt) { using (var context = new QuanLyDaoTaoEntities()) { var query = context.HeDaoTaos.Where(x => x.MaHDT == hdt.MaHDT).FirstOrDefault(); context.Entry(query).CurrentValues.SetValues(hdt); context.SaveChanges(); } }