Ejemplo n.º 1
0
 public static void Update(Nguoi nguoi)
 {
     using (var db = new tourEntities())
     {
         db.Entry(nguoi).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public static void Insert(Nguoi nguoi)
 {
     using (var db = new tourEntities())
     {
         db.Nguois.Add(nguoi);
         db.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public static void Delete(Nguoi nguoi)
 {
     using (var db = new tourEntities())
     {
         var result = (from c in db.Nguois where c.Id == nguoi.Id select c).First();
         db.Nguois.Remove(result);
         db.SaveChanges();
     }
 }
Ejemplo n.º 4
0
 public static List <DoanDL> getDoanDaDi(Nguoi nguoi)
 {
     using (var db = new tourEntities())
     {
         List <CTDoan> result = (from c in db.CTDoans where c.MaNguoiThamGia == nguoi.Id select c).ToList();
         List <DoanDL> kq     = new List <DoanDL>();
         foreach (CTDoan ct in result)
         {
             kq.Add((from c in db.DoanDLs where c.Id == ct.MaDoan select c).FirstOrDefault());
         }
         return(kq.Distinct().ToList <DoanDL>());
     }
 }