private void Table_Load(object sender, EventArgs e) { using (LoanAppEntities lapp = new LoanAppEntities()) { dataGridView1.DataSource = lapp.Allviews.ToList(); lapp.SaveChanges(); } }
private void button1_Click(object sender, EventArgs e) { using (LoanAppEntities app = new LoanAppEntities()) { app.Loans.Add(new Loan { LoanDate = Convert.ToDateTime(dateTimePicker1.Text), Amount = Convert.ToDecimal(textBox2.Text) }); app.SaveChanges(); } }
private void button1_Click(object sender, EventArgs e) { using (LoanAppEntities app = new LoanAppEntities()) { app.Loans.Add(new Loan { LoanDate = dateTimePicker1.Value, Amount = Convert.ToDecimal(textBox2.Text), CustomerId = app.Customers.ToList().LastOrDefault().Id }); app.SaveChanges(); } }
private void button1_Click(object sender, EventArgs e) { FN = textBox1.Text; CreditInfo info = new CreditInfo(); info.ShowDialog(); using (LoanAppEntities loanapp = new LoanAppEntities()) { loanapp.Customers.Add(new Customer { Name = FN, Passport = textBox2.Text }); loanapp.SaveChanges(); } }