Ejemplo n.º 1
0
 private void btn_CalisanEkle_Click(object sender, EventArgs e)
 {
     if (HelperLayer.Helper.AlanKontrol(this))
     {
         KullanicilarRepository repo = new KullanicilarRepository();
         Kullanicilar           b    = new Kullanicilar()
         {
             KullaniciAd     = txt_CalisanAd.Text,
             KullaniciSoyad  = txt_CalisanSoyad.Text,
             KullaniciAdi    = txt_CalisanAdi.Text,
             KullaniciParola = HelperLayer.Helper.MD5eDonustur(txt_CalisanSifre.Text),
             FirmaId         = firmalar.Find(x => x.FirmaAdi == cmb_FirmaId.SelectedItem.ToString()).FirmaId,
             RolId           = 1
         };
         if (repo.Ekle(b))
         {
             MessageBox.Show("Eklendi");
         }
         else
         {
             MessageBox.Show("Kayıt esnasında hata");
         }
     }
     else
     {
         MessageBox.Show("Alanlar boş geçilemez");
     }
 }
        public void KullanicilarEkle(KullanicilarDTO entity)
        {
            Kullanici kullanici = new Kullanici
            {
                KullaniciYetkiID = entity.KullaniciYetkiID,
                KullaniciAdi     = entity.KullaniciAdi,
                KullaniciSifre   = entity.KullaniciSifre,
                AdSoyad          = entity.AdSoyad,
                Telefon          = entity.Telefon,
                Email            = entity.Email
            };

            kullanicilarRepository.Ekle(kullanici);
            kullanicilarRepository.Context.SaveChanges();
        }