User-1651604128 posted
Hi,
I have a mvc web app with a filter (search) form, the Filter button contains a complicated native SQL query such as this:
//the method of controller below needs to return PagedList<tbl_Product> and call SelectRows
return new PagedList<tbl_Product>(SelectRows(button, txtFilter1, txtFilter2, txtFilter3, txtFilter4);
private IQueryable<tbl_Product> SelectRows(string txtFilter1, string txtFilter2, string txtFilter3, string txtFilter4,,,,)
{
....
string strSQL = "Select * from tbl_Product where ......."
var SearchResultData = db.Database.SqlQuery<tbl_Product>(strSQL).ToList();
//now, I need to return the above SearchResultData to IQuerable as below,
return db.tbl_Product.AsExpandable().Where(SearchResultData); //but this is not compatable,
Is that possible to make it working? thanks a lot,