private void btnSearch_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(txtName.Text) && !string.IsNullOrWhiteSpace(txtSname.Text)) { if (db.Customers.FirstOrDefault(s => s.FirstName.ToLower() == txtName.Text.ToLower() && s.LastName.ToLower() == txtSname.Text.ToLower()) != null) { int customerId = db.Customers.FirstOrDefault(s => s.FirstName.ToLower() == txtName.Text.ToLower() && s.LastName.ToLower() == txtSname.Text.ToLower()).Id; ChooseCar car = new ChooseCar(customerId); car.Show(); } else { MessageBox.Show("This customer not found. PLease register now"); } } else { lblRegOrError.Text = "Please fill all required(*) data"; } }
private void btnChooseCar_Click(object sender, EventArgs e) { ChooseCar car = new ChooseCar(CustomerId); car.Show(); }