In asp.net MVC I have a search action in my controller and I'm trying to solve. If I have to pass the request to my repository as a string
public ActionResult Search(string query)
{
return View(_repository.ListPeople(query));
}
or as separate parameters:
public ActionResult Search(string FirstName, string LastName, System.Nullable<byte> Education)
{
return View(_repository.ListPeople(FirstName, LastName, Education));
}
Many of the examples I've seen on the Internet use the query string method, but it doesn't feel “safe” for me, although it’s a little easier to handle when you have a bunch of parameters to go through. Is there a general consensus on a better way to do this?
source
share