예제 #1
0
        public void Sort(object parameter)
        {
            string         column = parameter as string;
            List <AutoDto> AutosSorted;

            switch (column)
            {
            case "Marke":
                if (_counter == 1)
                {
                    AutosSorted = Autos
                                  .OrderByDescending(s => s.Marke)
                                  .ToList();
                    Autos    = AutosSorted;
                    _counter = 0;
                }
                else
                {
                    AutosSorted = Autos
                                  .OrderBy(s => s.Marke)
                                  .ToList();
                    Autos = AutosSorted;
                    _counter++;
                }
                break;

            case "Autoklasse":
                if (_counter == 1)
                {
                    AutosSorted = Autos
                                  .OrderByDescending(s => s.AutoKlasse)
                                  .ToList();
                    Autos    = AutosSorted;
                    _counter = 0;
                }
                else
                {
                    AutosSorted = Autos
                                  .OrderBy(s => s.AutoKlasse)
                                  .ToList();
                    Autos = AutosSorted;
                    _counter++;
                }
                break;

            case "Tarif":
                if (_counter == 1)
                {
                    AutosSorted = Autos
                                  .OrderByDescending(s => s.Tagestarif)
                                  .ToList();
                    Autos    = AutosSorted;
                    _counter = 0;
                }
                else
                {
                    AutosSorted = Autos
                                  .OrderBy(s => s.Tagestarif)
                                  .ToList();
                    Autos = AutosSorted;
                    _counter++;
                }
                break;
            }

            OnPropertyChanged(nameof(Autos));
        }