private void btnXoa_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 1) { int id = (int)dataGridView1.SelectedRows[0].Cells[0].Value; var result = db.SinhViens.Find(id); db.SinhViens.Remove(result); db.SaveChanges(); load(); } }
private void btnSave_Click(object sender, EventArgs e) { var result = db.SinhViens.Find(ID); result.Hoten = txtName.Text; result.MSSV = txtMSSV.Text; result.Khoa = cbbKhoa.Text; db.Entry(result).State = EntityState.Modified; db.SaveChanges(); this.Close(); }
private void button2_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 1) { string id = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); var rs = db.MuonSaches.Find(id); db.MuonSaches.Remove(rs); db.SaveChanges(); loadsach(); } }
private void btnSave_Click(object sender, EventArgs e) { var result = db.MuonSaches.Find(ID); result.TenSach = txtTen.Text; result.SoLuong = int.Parse(txtSL.Text); result.LoaiSach = cbbLoai.Text; result.TacGia = txtTG.Text; db.Entry(result).State = EntityState.Modified; db.SaveChanges(); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { var rs = new SinhVien { Hoten = txtName.Text, MSSV = txtMSSV.Text, Khoa = cbbKhoa.Text, }; db.SinhViens.Add(rs); db.SaveChanges(); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { var rs = new MuonSach { MaSach = txtMa.Text, TenSach = txtTen.Text, SoLuong = int.Parse(txtSL.Text), LoaiSach = cbbLoai.Text, TacGia = txtTG.Text }; db.MuonSaches.Add(rs); db.SaveChanges(); this.Close(); }