public async void DeletePilot() { if (await service.DeleteEntity(SelectedPilot.Id)) { Pilots.Remove(Pilots.FirstOrDefault(c => c.Id == SelectedPilot.Id)); } }
public bool RemovePilot(Guid id) { if (!Pilots.ContainsKey(id)) { return(false); } Pilots[id].Dispose(); Pilots.Remove(id); NotifySquadronChanges(); return(true); }
private async void DeletePilot() { try { await _service.DeleteAsync(SelectedPilot.Id); Pilots.Remove(SelectedPilot); } catch (System.InvalidOperationException ex) { await _dialogService.ShowMessage(ex.Message, "Error"); } }
private async void BtnDelete_OnClick(object sender, RoutedEventArgs e) { Canvas.Visibility = Visibility.Visible; try { await Service.Delete(_selectedPilot.Id); } catch { Info.Text = "Server error!"; } Pilots.Remove(_selectedPilot); }
private async void UpdatePilot() { try { var resultItem = await _service.UpdateAsync(SelectedPilot); Pilots.Remove(SelectedPilot); Pilots.Insert(0, resultItem); } catch (System.InvalidOperationException ex) { await _dialogService.ShowMessage(ex.Message, "Error"); } }
private async void Delete() { if (selectedPilot == null) { return; } await airportConnector.PilotEndpoint.Delete(selectedPilot.Id); Pilots.Remove(selectedPilot); selectedPilot = null; RaisePropertyChanged(() => Pilots); RaisePropertyChanged(() => SelectedPilot); }