/// <summary> /// Change max-number of SONOTOIDA in LOAIDL /// </summary> /// <param name="maloaidl"></param> /// <param name="sonotoida"></param> /// <returns></returns> public bool ChangeMaxNumOfTienNo(int maloaidl, int sonotoida) { using (QLDLEntities db = new QLDLEntities()) { LOAIDL loaidl = db.LOAIDLs.Where(p => p.MALOAI == maloaidl).Single(); loaidl.SONOTOIDA = sonotoida; db.SaveChanges(); return(true); } }
/// <summary> /// insert a record into table LOAIDL- increament number of LOAIDL /// </summary> /// <param name="tenloai"></param> /// <param name="sonotoida"></param> /// <returns></returns> public bool InsertLoaiDL(string tenloai, int sonotoida) { using (QLDLEntities db = new QLDLEntities()) { LOAIDL dl = new LOAIDL(); dl.TENLOAI = tenloai; dl.SONOTOIDA = sonotoida; db.LOAIDLs.Add(dl); db.SaveChanges(); //insert suceed return(true); } }
/// <summary> /// delete a record into table LOAIDL - descreament number of LOAIDL /// </summary> /// <param name="loaidl"></param> /// <returns></returns> public bool DeleteLAOIDL(int loaidl) { using (QLDLEntities db = new QLDLEntities()) { if (db.DAILies.Where(p => p.LOAIDL == loaidl).Count() <= 0) { LOAIDL ldl = db.LOAIDLs.Where(p => p.MALOAI == loaidl).Single(); db.LOAIDLs.Remove(ldl); db.SaveChanges(); //delete succeed return(true); } //delete false return(false); } }