//Thêm public bool them_Tang(TANG tg) { try { data.TANGs.InsertOnSubmit(tg); data.SubmitChanges(); return(true); } catch { return(false); } }
//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); } }
//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); } }