private void btnXoa_Click(object sender, EventArgs e) { using (CUAHANGTIENLOI db = new CUAHANGTIENLOI()) { NHACUNGCAP ncc = db.NHACUNGCAPs.Where(p => p.MANCC.ToString() == txtMaNCC.Text).FirstOrDefault(); db.NHACUNGCAPs.Remove(ncc); db.SaveChanges(); } loadDL(); }
private void btnSua_Click(object sender, EventArgs e) { using (CUAHANGTIENLOI db = new CUAHANGTIENLOI()) { NHACUNGCAP ncc = db.NHACUNGCAPs.Where(p => p.MANCC.ToString() == txtMaNCC.Text).FirstOrDefault(); ncc.TENNCC = txtTenNCC.Text; ncc.SDT = txtSDT.Text; ncc.GMAIL = txtGmail.Text; ncc.DIACHI = txtDiaChi.Text; db.SaveChanges(); } loadDL(); }
private void btnThem_Click(object sender, EventArgs e) { using (CUAHANGTIENLOI db = new CUAHANGTIENLOI()) { NHACUNGCAP ncc = new NHACUNGCAP(); ncc.TENNCC = txtTenNCC.Text; ncc.SDT = txtSDT.Text; ncc.GMAIL = txtGmail.Text; ncc.DIACHI = txtDiaChi.Text; db.NHACUNGCAPs.Add(ncc); db.SaveChanges(); } loadDL(); }