ddd
This commit is contained in:
57
FrmAddKullanici.cs
Normal file
57
FrmAddKullanici.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user