MCPcopy Create free account
hub / github.com/TryCatchLearn/Restore-v2 / Sort

Method Sort

API/Extensions/ProductExtensions.cs:8–18  ·  view source on GitHub ↗
(this IQueryable<Product> query, string? orderBy)

Source from the content-addressed store, hash-verified

6public static class ProductExtensions
7{
8 public static IQueryable<Product> Sort(this IQueryable<Product> query, string? orderBy)
9 {
10 query = orderBy switch
11 {
12 "price" => query.OrderBy(x => x.Price),
13 "priceDesc" => query.OrderByDescending(x => x.Price),
14 _ => query.OrderBy(x => x.Name)
15 };
16
17 return query;
18 }
19
20 public static IQueryable<Product> Search(this IQueryable<Product> query, string? searchTerm)
21 {

Callers 1

GetProductsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected