private void btnGuncelle_Click(object sender, EventArgs e) { var controlcar = carServices.Control((cmbModelAdı.SelectedValue as Model).Name, tbMarkaAdi.Text, (cmbKasaTipi.SelectedValue as VehicleBody), (cmbRenk.SelectedValue as Core.Entities.Color), (cmbYil.SelectedValue as Year).Years); if (controlcar > 0) { MessageBox.Show(Error.UserError.ErrorMessage(Convert.ToInt32(Error.UserError.ErrorCode.KayitOncedenEklenmis))); } else { var updatedID = carServices.Find(Convert.ToInt32(dgvAracData.CurrentRow.Cells[0].Value.ToString())); if (updatedID != null) { var update = carServices.Update(new Car() { Model_ID = updatedID.Model_ID = (cmbModelAdı.SelectedValue as Model).ID, BodyType = updatedID.BodyType = (cmbKasaTipi.SelectedValue as VehicleBody), ColorID = updatedID.ColorID = (cmbRenk.SelectedValue as Core.Entities.Color), Years = updatedID.Years = (cmbYil.SelectedValue as Year).Years, SalePrice = updatedID.SalePrice = Convert.ToDecimal(tbSatisFiyati.Text), IsRental = updatedID.IsRental = checkKiralık.Checked }); if (update > 0) { MessageBox.Show(Error.UserError.ErrorMessage(Convert.ToInt32(Error.UserError.ErrorCode.KayitGuncellendi))); dgvAracData.DataSource = carServices.Select(); } else { MessageBox.Show(Error.UserError.ErrorMessage(Convert.ToInt32(Error.UserError.ErrorCode.KayitGuncellendi))); dgvAracData.DataSource = carServices.Select(); } } else { MessageBox.Show(Error.UserError.ErrorMessage(Convert.ToInt32(Error.UserError.ErrorCode.KayitBulunamadı))); } } }