private void Button_Click_1(object sender, RoutedEventArgs e) { var op = CustomerBLL.Update(new Customer() { Id = thisCustomer.Id, BillingAddress = txtBillAddresss.Text, CustomerName = txtName.Text, Default_ShippingAddress = txtShipAddress.Text, Customer_EmailAddress = txtEmail.Text, Customer_ContactNumber = txtPNumber.Text }); if (op.Code != "200") { MessageBox.Show("Error : " + op.Message); } else { MessageBox.Show("Employee is successfully updated"); } myParentWindow.showData(); this.Close(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { List <string> errors = new List <string>(); if (string.IsNullOrEmpty(txtName.Text)) { errors.Add("First Name is required."); } ; if (string.IsNullOrEmpty(txtBillAddresss.Text)) { errors.Add("Billing Address is required."); } ; if (string.IsNullOrEmpty(txtPNumber.Text)) { errors.Add("Password is required."); } ; if (string.IsNullOrEmpty(txtEmail.Text)) { errors.Add("Email is required."); } ; if (string.IsNullOrEmpty(txtShipAddress.Text)) { errors.Add("Shipping Address is required."); } ; var message = string.Join(Environment.NewLine, errors); if (errors.Count > 0) { MessageBox.Show(message); } var op = CustomerBLL.Add(new Customer() { Id = Guid.NewGuid(), CustomerName = txtName.Text, Customer_ContactNumber = txtPNumber.Text, Customer_EmailAddress = txtEmail.Text, BillingAddress = txtBillAddresss.Text, Default_ShippingAddress = txtShipAddress.Text }); if (op.Code != "200") { MessageBox.Show("Error : " + op.Message); } else { MessageBox.Show("Employee is successfully added to table"); } myParentWindow.showData(); this.Close(); }