protected override async void ExecuteChangeCommand(object obj) { if (_viewModel.SelectedBettor == null) { MessageBox.Show("Bitte wählen Sie einen Tipper aus!", "Kein Tipper ausgewählt", MessageBoxButton.OK, MessageBoxImage.Warning); return; } var addBettorWindow = new AddBettorWindowController { Bettor = _viewModel.SelectedBettor }; var showBettor = addBettorWindow.ShowBettor(); // it could be possible that the bettor is null if (showBettor == null) { ReloadModels(); return; } // Check if service is available if (!await AdminClientHelper.IsAvailable(_adminClient)) { return; } // add bettor var isUpdated = await _adminClient.UpdateBettorAsync(showBettor); UpdateModels(isUpdated, "Der Benutzer konnte nicht geändert werden!", "Änderung fehlgeschlagen"); }
protected override async void ExecuteAddCommand(object obj) { var addBettorWindow = new AddBettorWindowController { Bettor = new Bettor() }; var showBettor = addBettorWindow.ShowBettor(); // it could be possible that the bettor is null if (showBettor == null) { return; } // Check if service is available if (!await AdminClientHelper.IsAvailable(_adminClient)) { return; } // add bettor var isAdded = await _adminClient.AddBettorAsync(showBettor); UpdateModels(isAdded, "Tipper konnte nicht hinzugefügt werden, da der Nickname schon vergeben ist!", "Hinzufügen fehlgeschlagen"); }