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
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());
- }

Jignesh KumarRank #91 · 22.9K reputationPosted Apr 18, 2021, 12:01 AM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 18, 2021, 12:27 PM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Apr 18, 2021, 12:32 PM EDT
osyris zosarRank #6,574 · 262 reputationPosted Apr 18, 2021, 10:40 AM EDT
osyris zosarRank #6,574 · 262 reputationPosted Apr 18, 2021, 2:25 PM EDT
it doesnt matter how many Iquaryable filters I use, Iquaryable always merges the filters together?
I have not seen that before, and can you place other codes there as well? if so what is the use for that?
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 20, 2021, 2:37 AM EDT