Skip to content

Instantly share code, notes, and snippets.

@heldersepu
Last active October 31, 2017 17:47
Show Gist options
  • Save heldersepu/4cb5ca60517f75784edb87356bca0c30 to your computer and use it in GitHub Desktop.
Save heldersepu/4cb5ca60517f75784edb87356bca0c30 to your computer and use it in GitHub Desktop.
Customers_Add.CS
private void btnOkEdit_Click(object sender, RoutedEventArgs e)
{
using (var db = new invoiceFEntities())
{
customer existingCust = new customer
{
Id = Convert.ToInt32(lblId.Content),
fname = txtFNameIns.Text.ToString(),
lname = txtLNameIns.Text.ToString(),
dateofservice = string.Format("{0:MM/dd/yyyy}", datDateIns.SelectedDate.Value),
phone = txtPhoneIns.Text.ToString(),
email = txtEmailIns.Text.ToString(),
description = txtDescription.Text.ToString()
};
db.customers.AddOrUpdate(existingCust);
db.SaveChanges();
//db.Dispose();
}
//notify
MessageBoxButton button = MessageBoxButton.OK;
string message = string.Format("Customer {0} was edited.", txtFNameIns.Text.ToString());
MessageBox.Show(message, "Information", button);
this.Close();
//MainWindow.btnS.(this, new RoutedEventArgs());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment