public Hobiler HobilerMapping(HobilerDTO hobilerDTO) { Hobiler hobi = new Hobiler(); hobi.HobiAdi = hobilerDTO.HobiAdi;; hobi.HobiUstKategoriID = hobilerDTO.HobiUstKategoriID; return(hobi); }
public HobilerDTO HobilerDTOMapping(Hobiler hobiler) { HobilerDTO dto = new HobilerDTO(); dto.HobiAdi = hobiler.HobiAdi; dto.HobiID = hobiler.HobiID; dto.HobiUstKategoriID = hobiler.HobiUstKategoriID; return(dto); }
private void btnUstKatEkle_Click(object sender, EventArgs e) { HobilerDTO hobilerDTO = new HobilerDTO(); hobilerDTO.HobiAdi = txtUstKatAdi.Text; hobilerDTO.HobiUstKategoriID = null; if (_hc.HobiEkle(hobilerDTO)) { MessageBox.Show("Kayıt başarılı"); UstKategoriListele(); } else { MessageBox.Show("Kayıt başarısız"); } }
public bool HobiEkle(HobilerDTO dto) { Hobiler hobi = HobilerMapping(dto); try { if (_hm.HobiEkle(hobi) > 0) { return(true); } } catch (Exception) { throw; } return(false); }
private void btnAltKatEkle_Click(object sender, EventArgs e) { if (lstUstKategoriler.SelectedIndex == -1) { MessageBox.Show("Eklemek istediğiniz Hobinin Üst Hobisini seçiniz."); return; } HobilerDTO hobilerDTO = new HobilerDTO(); hobilerDTO.HobiAdi = txtAltKatAdi.Text; hobilerDTO.HobiUstKategoriID = (int)lstUstKategoriler.SelectedValue; //secilen ust kategorinin id si if (_hc.HobiEkle(hobilerDTO)) { MessageBox.Show("Kayıt başarılı"); UstKategoriListele(); } else { MessageBox.Show("Kayıt başarısız"); } }