private void Sort(SortState sortOrder) { Users = sortOrder switch { SortState.NameDesc => Users.OrderByDescending(user => user.Fullname), SortState.UserLoginAsc => Users.OrderBy(user => user.Login), SortState.UserLoginDesc => Users.OrderByDescending(user => user.Login), _ => Users.OrderBy(user => user.Fullname), }; SortModel = new SortViewModel(sortOrder); }
private void Sort(SortState sortOrder) { Beers = sortOrder switch { SortState.NameDesc => Beers.OrderByDescending(beer => beer.Name), SortState.BeerPriceAsc => Beers.OrderBy(beer => beer.Price), SortState.BeerPriceDesc => Beers.OrderByDescending(beer => beer.Price), _ => Beers.OrderBy(beer => beer.Name), }; SortModel = new SortViewModel(sortOrder); }