I know how to create single search on products
But how do I filter products base on multiple Fields
for example search on Title, price, brand and discription at the same time
What would be to most professional way to achive this
Single filter:
- public async Task<IActionResult> Index(string Title, string price, string discription , string brand)
- {
- var products = from m in _context.Product
- select m;
-
- if (!string.IsNullOrEmpty(Title))
- {
- products = _context.Product.Where(x => x.Title.ToLower().Contains(Title.ToLower()));
-
- }
- return View(await products.ToListAsync());
- }