private void Button1_Click(object sender, EventArgs e) { AirlineDbEntities db = new AirlineDbEntities(); if (usrtxt.Text != string.Empty && passtxt.Text != string.Empty) { var user = db.Admins.Where(a => a.Username.Equals(usrtxt.Text)).SingleOrDefault(); if (user != null) { if (user.Password.Equals(passtxt.Text)) { MessageBox.Show("Login Admin"); } else { MessageBox.Show("Wrong Password!"); } } else { MessageBox.Show("Wrong Username!"); } } else { MessageBox.Show("Please fill Username & Pssword"); } }
private void Button1_Click(object sender, EventArgs e) { AirlineDbEntities db = new AirlineDbEntities(); Customer_Details customers = new Customer_Details { Name = nametxt.Text, FatherName = fathertxt.Text, BirthDate = birthdate.Value, Email = emailtxt.Text, Phone = phonetxt.Text, Address = addresstxt.Text }; db.Customer_Details.Add(customers); db.SaveChanges(); MessageBox.Show("Add one customer"); }