protected override async void OnNavigatedTo(NavigationEventArgs e) { var result = await Service.GetAll(); result.ForEach(x => AircraftTypes.Add(x)); lastId = AircraftTypes.LastOrDefault().Id; }
private async void BtnCreate_OnClick(object sender, RoutedEventArgs e) { Canvas.Visibility = Visibility.Collapsed; if (isCreate) { var stewardess = ReadTextBoxesData(); if (stewardess != null) { try { await Service.Create(stewardess); } catch { Info.Text = "Server error!"; } lastId++; stewardess.Id = lastId; AircraftTypes.Add(stewardess); isCreate = false; CreateInfo(); Info.Text = "Choose new action!"; } } else { CreateInfo(); isCreate = true; Info.Text = "Info : Input data and press 'Create' "; } }