0

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'

5
  • You confused me...are you talking about url query string parameters? What have you done so far? Can you add some code to your question so we can properly "guess" what you are talking about? Commented Dec 27, 2013 at 2:53
  • sorry. I updated question. Please let me know if there is more confusion so that I can edit it again. Commented Dec 27, 2013 at 3:00
  • Why do you need to do that? I mean...why dont you pass those values to the controller action method? Commented Dec 27, 2013 at 3:32
  • What filtering values do you need to pass as lambda? Name and title only? Commented Dec 27, 2013 at 3:35
  • I have a jquery UI dialog which has query builder like TFS query builder. I am taking inputs filtered by user in query builder and pass them to controller and then generate lambda expression with those inputs. I had just given sample with name and title to get logic. Commented Dec 27, 2013 at 4:04

1 Answer 1

1

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)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.