public NIslemSonuc <int> Ekle(PersonelTip tip) { try { entity.PersonelTip.Add(tip); entity.SaveChanges(); return(new NIslemSonuc <int> { basariliMi = true, Veri = tip.tip_id, mesaj = "Tip Kaydı Başarılı!" }); } catch (Exception ex) { return(new NIslemSonuc <int> { basariliMi = false, hata = new NHata { aciklama = "Ekleme Metodunda Hata", mesaj = ex.Message, strace = ex.StackTrace, sinif = "PersonelTip Veritabani", tarih = DateTime.Now }, mesaj = "Sistemde Bir Hata Oluştu!" }); } }
protected void BtnKaydet_Click(object sender, EventArgs e) { if (TxtTipAd.Text != "") { PersonelTip tip = new PersonelTip { ad = TxtTipAd.Text }; var sonuc = tip_veritabani.Ekle(tip); if (sonuc.basariliMi) { Listele(); } } }