/// <summary> /// insert a record into table DVT- increament number of DVT /// </summary> /// <param name="tendvt"></param> /// <returns></returns> public bool InsertDVT(string tendvt) { using (QLDLEntities db = new QLDLEntities()) { DVT dvt = new DVT(); dvt.DVT1 = tendvt; db.DVTs.Add(dvt); db.SaveChanges(); return(true); } }
/// <summary> /// delete a record into table DVT - descreament number of DVT /// </summary> /// <param name="madvt"></param> /// <returns></returns> public bool DeleteDVT(int madvt) { using (QLDLEntities db = new QLDLEntities()) { if (db.MATHANGs.Where(p => p.MADVT == madvt).Count() <= 0) { DVT dvt = db.DVTs.Where(p => p.MADVT == madvt).Single(); db.DVTs.Remove(dvt); db.SaveChanges(); return(true); } return(false); } }