Created
May 17, 2020 23:15
-
-
Save zHaytam/c97dccf923440a5820ba7032b2a5783b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IQueryable<Product> ApplyOrderBy(IQueryable<Product> query, string property) | |
{ | |
switch (property) | |
{ | |
case "Name": | |
return query.OrderBy(p => p.Name); | |
case "Quantity": | |
return query.OrderBy(p => p.Quantity); | |
case "Price": | |
return query.OrderBy(p => p.Price); | |
default: | |
return query; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment