Reputation: 6762
I am trying to send a query like below from UI to controller.
name='abc' and title='def'
I am trying to use lambda expression on controller to filter this query. But I am struggling hard to pass ui query to controller and make it as lambda expression.
Could you please throw some idea with example where i can pass sql query(string) as parameter and use it in controller action method as lambda expression. Any link or logic should be fine for me to try further.
[HttpGet]
public virtual ActionResult QueriedProjects(string builtQuery)
{
var Helpera = new Helpera(true);
var myProjectDetails = Helpera.myProjectDetails (null);
var myProjectDetails = new myProjectDetails ()
{ GetMyProjectDetails = myProjectDetails };
return View(myProjectDeails)
}
UI
on button click I am generating a query as string with entered values in query builder
Generated String: name='abc' and title= 'def'
Upvotes: 0
Views: 927
Reputation: 6775
If you pass values like this:
Contoller/QueriedProjects?name=abc&title=def
You need to have 2 parameters in your controller method like:
public virtual ActionResult QueriedProjects(string name, string title)
Upvotes: 1