private void button1_Click(object sender, EventArgs e) { using (BankDbEntities bank = new BankDbEntities()) { bank.Kredits.Add(new Kredit() { User_id = bank.People.ToList().Last().Id, time = dateTimePicker1.Value, price = Convert.ToInt32(textBox3.Text) }); bank.SaveChanges(); } }
private void button1_Click(object sender, EventArgs e) { using (BankDbEntities bank = new BankDbEntities()) { bank.People.Add(new Person() { Name = textBox1.Text, Surname = textBox2.Text, PassportNumber = textBox3.Text }); bank.SaveChanges(); } SecondForm secondForm = new SecondForm(); secondForm.ShowDialog(); }