Ejemplo n.º 1
0
 /// <summary>
 /// Lấy 1 record dựa vào mã lớp tín chỉ
 /// </summary>
 /// <param name="maLop"></param>
 /// <returns>Khoa</returns>
 public LopTinChi GetById(int id)
 {
     using (var context = new QuanLyDaoTaoEntities())
     {
         LopTinChi lop = context.LopTinChis.Where(x => x.MaLopTC == id).FirstOrDefault();
         return(lop);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Tạo mới 1 record
 /// </summary>
 /// <param name="lop">lop</param>
 public void Create(LopTinChi lop)
 {
     using (var context = new QuanLyDaoTaoEntities())
     {
         context.LopTinChis.Add(lop);
         context.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Chỉnh sửa 1 record
 /// </summary>
 /// <param name="lop"></param>
 public void Edit(LopTinChi lop)
 {
     using (var context = new QuanLyDaoTaoEntities())
     {
         var query = context.LopTinChis.Where(x => x.MaLopTC == lop.MaLopTC).FirstOrDefault();
         context.Entry(query).CurrentValues.SetValues(lop);
         context.SaveChanges();
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 ///  Xoa 1 record dựa vào mã lop
 /// </summary>
 /// <param name="maLop"></param>
 public void Delete(int maLop)
 {
     using (var context = new QuanLyDaoTaoEntities())
     {
         LopTinChi lp = context.LopTinChis.Find(maLop);
         if (lp != null)
         {
             context.LopTinChis.Remove(lp);
             context.SaveChanges();
         }
     }
 }