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 KumarPosted Apr 20, 2021, 6:37 AM
osyris zosarPosted Apr 18, 2021, 6:25 PM
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?
Sachin SinghPosted Apr 18, 2021, 4:32 PM
Jignesh KumarPosted Apr 18, 2021, 4:27 PM
osyris zosarPosted Apr 18, 2021, 2:40 PM
Jignesh KumarPosted Apr 18, 2021, 4:01 AM