private void BtnAddPaymentType_Click(object sender, RoutedEventArgs e) { var paymentTypeDescription = txtPaymentTypeDescription.Text; var paymentTypeLongDescription = txtPaymentTypeLongDescription.Text; if (string.IsNullOrWhiteSpace(paymentTypeDescription)) { MessageBox.Show("Code is blank"); } if (string.IsNullOrWhiteSpace(paymentTypeLongDescription)) { MessageBox.Show("Description is blank"); } var result = paymentTypeCommand.Add( paymentTypeDescription, paymentTypeLongDescription); if (result.IsFailure) { MessageBox.Show(result.Error); } if (result.IsSuccess) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("PaymentType")); MessageBox.Show("Payment Type Added"); } } }
public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } if (PaymentType.Id != Guid.Empty) { paymentTypeCommand.Update(PaymentType); } else { var result = paymentTypeCommand.Add(PaymentType.Description, PaymentType.LongDescription); if (result.IsFailure) { TempData["Error"] = result.Error; return(Page()); } } return(RedirectToPage("./Detail", new { paymenttypeid = PaymentType.Id })); }