Example #1
0
 public void Create(HeDaoTao hdt)
 {
     using (var context = new QuanLyDaoTaoEntities())
     {
         context.HeDaoTaos.Add(hdt);
         context.SaveChanges();
     }
 }
Example #2
0
 public HeDaoTao GetById(string id)
 {
     using (var context = new QuanLyDaoTaoEntities())
     {
         HeDaoTao hdt = context.HeDaoTaos.Find(id);
         return(hdt);
     }
 }
Example #3
0
 public void Delete(string maHDT)
 {
     using (var context = new QuanLyDaoTaoEntities())
     {
         HeDaoTao hdt = context.HeDaoTaos.Find(maHDT);
         context.HeDaoTaos.Remove(hdt);
         context.SaveChanges();
     }
 }
Example #4
0
 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();
     }
 }