Я бы хотел заказать некоторые товары по ценам. Какие параметры я передаю своему действию и как использовать его при сортировке из IQueryable<Product>
?
Например, вот что у меня сейчас:
public ActionResult Index(int page =0, int cat = 0, int subCat =0)
{
var products = productService.GetAllProducts();
ProductListViewModel model = new ProductListViewModel();
if (cat > 0)
{
products = products.Where(p => p.SubCategory.CategoryId == cat);
}
if (subCat > 0)
{
products = products.Where(p => p.SubCategory.SubCategoryId == subCat);
}
products = products.OrderBy(p => p.CreatedDate);
model.PagedProducts = products.ToPagedList(page, 15);
return View(model);
}