/// <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);
     }
 }
 /// <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();
     }
 }
 /// <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();
     }
 }
 /// <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();
         }
     }
 }