private void cmddelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Bạn có chắc xóa mẫu tin này ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { FoodBL foodBL = new FoodBL(); if (foodBL.Delete(foodCurrent) > 0) { MessageBox.Show("Xóa thực phẩm thành công "); LoadFoodDataToListView(); } else { MessageBox.Show("Xóa không thành công "); } } }
private void btnDelete_Click(object sender, EventArgs e) { // Hỏi người dùng có chắc chắn xoá hay không? Nếu đồng ý thì if (MessageBox.Show("Bạn có chắc chắn muốn xoá mẫu tin này?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { // Khai báo đối tượng FoodBL từ BusinessLogic FoodBL foodBL = new FoodBL(); if (foodBL.Delete(foodCurrent) > 0)// Nếu xoá thành công { MessageBox.Show("Xoá thực phẩm thành công"); // Tải tữ liệu lên ListView LoadFoodDataToListView(); } else { MessageBox.Show("Xoá không thành công"); } } }