Last active
October 31, 2017 17:47
-
-
Save heldersepu/4cb5ca60517f75784edb87356bca0c30 to your computer and use it in GitHub Desktop.
Customers_Add.CS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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