Beispiel #1
0
 //Thêm
 public bool them_Tang(TANG tg)
 {
     try
     {
         data.TANGs.InsertOnSubmit(tg);
         data.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #2
0
        //Xóa

        public bool xoaTang(string pMaTang)
        {
            try
            {
                TANG tg = data.TANGs.Where(t => t.MATANG == pMaTang).FirstOrDefault();
                data.TANGs.DeleteOnSubmit(tg);
                data.SubmitChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #3
0
 //Sửa
 public bool suaTang(TANG pTang)
 {
     try
     {
         TANG nv = data.TANGs.Where(t => t.MATANG == pTang.MATANG).FirstOrDefault();
         if (nv != null)
         {
             nv.TENTANG = pTang.TENTANG;
             data.SubmitChanges();
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }