示例#1
0
 /// <summary>
 /// Tạo mới 1 record
 /// </summary>
 /// <param name="nienKhoaHocKy">Niên khóa học kỳ</param>
 public void Create(NienKhoaHocKy nienKhoaHocKy)
 {
     using (var context = new QuanLyDaoTaoEntities())
     {
         context.NienKhoaHocKies.Add(nienKhoaHocKy);
         context.SaveChanges();
     }
 }
示例#2
0
 /// <summary>
 /// Lấy 1 record dựa vào ID
 /// </summary>
 /// <param name="ID"></param>
 /// <returns>NienKhoaHocKy</returns>
 public NienKhoaHocKy GetById(string ID)
 {
     using (var context = new QuanLyDaoTaoEntities())
     {
         NienKhoaHocKy nk = context.NienKhoaHocKies.Where(x => x.ID == ID).FirstOrDefault();
         return(nk);
     }
 }
示例#3
0
 /// <summary>
 /// Chỉnh sửa 1 record
 /// </summary>
 /// <param name="nienKhoaHocKy"></param>
 public void Edit(NienKhoaHocKy nienKhoaHocKy)
 {
     using (var context = new QuanLyDaoTaoEntities())
     {
         var query = context.NienKhoaHocKies.Where(x => x.ID == nienKhoaHocKy.ID).FirstOrDefault();
         context.Entry(query).CurrentValues.SetValues(nienKhoaHocKy);
         context.SaveChanges();
     }
 }
示例#4
0
 /// <summary>
 ///  Xoa 1 record dựa vào ID
 /// </summary>
 /// <param name="ID"></param>
 public void Delete(string ID)
 {
     using (var context = new QuanLyDaoTaoEntities())
     {
         NienKhoaHocKy nkhk = context.NienKhoaHocKies.Find(ID);
         if (nkhk != null)
         {
             context.NienKhoaHocKies.Remove(nkhk);
             context.SaveChanges();
         }
     }
 }