private void btnCreate_Click(object sender, EventArgs e) { var nextContact = context.Contacts.OrderBy("it.ContactID DESC").First(); int nextContactID = nextContact.ContactID + 1; string[] name = txtTenant.Text.Split(' '); var contact = Contact.CreateContact(nextContactID, name[0].ToString(), name[1].ToString()); var address = new Address(); address.Address1 = txtAddress.Text; contact.ContactNumber = txtContactNum.Text; address.Mortgage = txtMortgage.Text; address.RemainingMortgage = txtRemainingMortgage.Text; address.Rent = txtRent.Text; address.Period = cboPeriod.SelectedIndex; address.RentArrears = txtRentArrears.Text; address.Rates = txtRates.Text; address.RatesUpToDate = chkRates.Checked; address.RentArrears = txtRentArrears.Text; address.Repairs = txtRepairs.Text; //join the new address to the contact address.Contact = contact; //add new graph to the contact context.AddToContacts(contact); context.SaveChanges(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)