using DugunSalonu.Models; using System.Threading.Tasks; namespace DugunSalonu { public partial class FrmAddKullanici : Form { public FrmAddKullanici() { InitializeComponent(); } private async void btnEkle_Click(object sender, EventArgs e) { if (txtParola.Text != txtParolatekrar.Text) { MessageBox.Show("Parolalar eşleşmiyor.", "Hata"); return; } using (dugunsalonuContext db = new dugunsalonuContext()) { await db.kullanici.AddAsync(new Kullanici { adi = txtAdi.Text, soyadi = txtSoyadi.Text, kullaniciadi = txtKullaniciAdi.Text, parola = txtParola.Text, aktif = true, admin = false, ceptel = txtCeptel.Text, eposta = txtEposta.Text }); await db.SaveChangesAsync(); FormTemizle(); MessageBox.Show("İşlem başarılı", "Ekleme"); } } private void btnVazgec_Click(object sender, EventArgs e) { Application.Exit(); } private void FormTemizle() { foreach (TextBox item in this.Controls) { if (item is TextBox) { item.Clear(); } } } } }