public ActionResult Register(CustomerViewModel customer) { try { _facade.CreateCustomer(customer.Username, customer.Name, customer.Pincode); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Created($"/credentials/{customer.Username}", customer)); }
bool EditInsteadOfSave; // true = opdater kunde .. false = opret ny kunde public CreateCustomerDialog(MainWindow mainWindow, CustomerFacade cfInput, AppointmentFacade afInput, List <ICustomer> customers) { InitializeComponent(); cf = cfInput; af = afInput; customersList = customers; icustomer = cf.CreateCustomer(); this.mainWindow = mainWindow; EditInsteadOfSave = false; appointments = new List <IAppointment>(); AppointmentListView.ItemsSource = appointments; }
private void btnSave_Click(object sender, RoutedEventArgs e) { CustomerVM vm = this.DataContext as CustomerVM; ValidationManager.Validate(this.gridCustomerInfo); bool flag1 = true; if (chkAgent.IsChecked.Value) { flag1 = ValidationManager.Validate(this.expAgentInfo); } if (vm.BasicInfo.ValidationErrors.Count == 0 && vm.ScoreInfo.ValidationErrors.Count == 0 && flag1) { if (vm.SysNo > 0) { facade.UpdateCustomer(vm, (obj, args) => { if (args.FaultsHandle()) { return; } Window.Alert(ResCustomerMaintain.Info_SaveSuccessfully); }); } else { facade.CreateCustomer(vm, (obj, args) => { if (args.FaultsHandle()) { return; } Window.Alert(ResCustomerMaintain.Info_SaveSuccessfully); Window.Navigate(string.Format(ConstValue.CustomerMaintainUrlFormat, args.Result.SysNo), null, false); }); } } }