in src/PartsUnlimitedWebsite/Areas/Admin/Controllers/StoreManagerController.cs [58:98]
private IQueryable<Product> Sort(IQueryable<Product> products, SortField sortField, SortDirection sortDirection)
{
if (sortField == SortField.Name)
{
if (sortDirection == SortDirection.Up)
{
return products.OrderBy(o => o.Category.Name);
}
else
{
return products.OrderByDescending(o => o.Category.Name);
}
}
if (sortField == SortField.Price)
{
if (sortDirection == SortDirection.Up)
{
return products.OrderBy(o => o.Price);
}
else
{
return products.OrderByDescending(o => o.Price);
}
}
if (sortField == SortField.Title)
{
if (sortDirection == SortDirection.Up)
{
return products.OrderBy(o => o.Title);
}
else
{
return products.OrderByDescending(o => o.Title);
}
}
// Should not reach here, but return products for compiler
return products;
}