Ejemplo n.º 1
0
        public async void Delete(object sender, RoutedEventArgs e)
        {
            if (SaveButton.Visibility == Visibility.Visible)
            {
                SaveButton.Visibility = Visibility.Collapsed;
            }

            if (AddButton.Visibility == Visibility.Visible)
            {
                AddButton.Visibility = Visibility.Collapsed;
            }

            try
            {
                if (TextId.IsReadOnly)
                {
                    TextId.IsReadOnly = false;
                }

                await _service.Delete(SelectedStewardesse.Id.ToString());

                // refresh listView
                Stewardesses.Clear();
                foreach (var airplaneType in await _service.LoadData())
                {
                    Stewardesses.Add(airplaneType);
                }
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 2
0
        protected void SearchAsync()
        {
            List <Stewardess> temp = Stewardesses.ToList();

            Stewardesses.Clear();
            if (string.IsNullOrWhiteSpace(SearchFilter))
            {
                temp.Clear();
                UpdateDataAsync();
            }
            else
            {
                Stewardesses = new ObservableCollection <Stewardess>(temp.Where(s => s.FirstName.StartsWith(SearchFilter, StringComparison.CurrentCultureIgnoreCase) ||
                                                                                s.LastName.StartsWith(SearchFilter, StringComparison.CurrentCultureIgnoreCase)).ToList());
            }
            RaisePropertyChanged(nameof(Stewardesses));
        }
Ejemplo n.º 3
0
        public async void LoadData(object sender, RoutedEventArgs e)
        {
            if (SaveButton.Visibility == Visibility.Visible)
            {
                SaveButton.Visibility = Visibility.Collapsed;
            }

            if (AddButton.Visibility == Visibility.Visible)
            {
                AddButton.Visibility = Visibility.Collapsed;
            }

            Stewardesses.Clear();
            foreach (var airplaneType in await _service.LoadData())
            {
                Stewardesses.Add(airplaneType);
            }
        }
Ejemplo n.º 4
0
        public async void Add(object sender, RoutedEventArgs e)
        {
            SelectedStewardesse.Id        = 0;
            SelectedStewardesse.FirstName = TextFirstName.Text;
            SelectedStewardesse.LastName  = TextLastName.Text;
            SelectedStewardesse.Birthdate = DateTime.Parse(TextBirthdate.Text);

            await _service.Create(SelectedStewardesse);

            AddButton.Visibility = Visibility.Collapsed;
            TextId.IsReadOnly    = false;

            // refresh listView
            Stewardesses.Clear();
            foreach (var airplaneType in await _service.LoadData())
            {
                Stewardesses.Add(airplaneType);
            }
        }