private void FilterByBrand() { ObservableCollection <GuitarModel> OrderedCollection = new ObservableCollection <GuitarModel>(); List <GuitarModel> OrderedList = ProductsToShow.ToList(); if (OrderDirection == 1) { OrderedList = OrderedList.OrderBy(i => i.BrandName).ToList(); } else if (OrderDirection == -1) { OrderedList = OrderedList.OrderByDescending(i => i.BrandName).ToList(); } foreach (GuitarModel model in OrderedList) { OrderedCollection.Add(model); } //OrderedCollection.Add(OrderedList[0]); //OrderedCollection.Add(OrderedList[2]); //OrderedCollection.Add(OrderedList[3]); ProductsToShow = OrderedCollection; }
private void FilterByStock() { ObservableCollection <GuitarModel> OrderedCollection = new ObservableCollection <GuitarModel>(); List <GuitarModel> OrderedList = ProductsToShow.ToList(); if (OrderDirection == 1) { OrderedList = OrderedList.OrderBy(i => i.Stock).ToList(); } else if (OrderDirection == -1) { OrderedList = OrderedList.OrderByDescending(i => i.Stock).ToList(); } foreach (GuitarModel model in OrderedList) { OrderedCollection.Add(model); } ProductsToShow = OrderedCollection; }