private void CarGridView_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { int rowIndex = e.RowIndex; int currentId = int.Parse(CarGridView.Rows[rowIndex].Cells[0].Value.ToString()); this.Hide(); CarExtras f2 = new CarExtras(currentId); f2.ShowDialog(); }
private void BtnCreate_Click(object sender, EventArgs e) { var selectedBrand = _brandRepository.GetAllBrands.SingleOrDefault(b => b.Name == InputBrandId.Text); bool hasInsurance = false; if (CbHasInsurance.Checked == true) { hasInsurance = true; } var car = new Car() { Model = InputModel.Text, Year = int.Parse(InputYear.Text), BrandId = selectedBrand.Id, HasInsurance = hasInsurance, }; int currentId = _carRepository.Add(car); ClearForm(); this.Hide(); CarExtras f2 = new CarExtras(currentId); f2.ShowDialog(); }