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) { Brand selectBrand = _brandRepository.GetAllBrands.SingleOrDefault(b => b.Name == InputBrandId.Text); var car = new Car() { Model = InputModel.Text, Year = int.Parse(InputYear.Text), BrandId = selectBrand.Id, }; int carId = _carRepository.Add(car); ClearForm(); this.Hide(); CarExtras f2 = new CarExtras(carId); f2.ShowDialog(); GetData(); }