public static void Delete(DiaDiem diadiem) { using (var db = new tourEntities()) { db.Entry(diadiem).State = EntityState.Deleted; db.SaveChanges(); } }
public static void Insert(DiaDiem diadiem) { using (var db = new tourEntities()) { db.DiaDiems.Add(diadiem); db.SaveChanges(); } }
public static Boolean KiemtraXoa(DiaDiem diadiem) { using (var db = new tourEntities()) { var result = from c in db.CTTours where c.MaDiaDiem == diadiem.Id select c; int sl = result.ToList <CTTour>().Count; if (sl == 0) { return(true); } return(false); } }