and thanks for reading.
I am building a data entry form. I am trying to figure out a way to let the user to provide a criteria (last name for instance), search the emplo
Something like this in the controller to search in the database (using linq) ?
public ActionResult searchEmployees(string searchString) {
var employees = (from e in db.Employees
where e.Name.Contains(searchString)
orderby e.Name
select e);
return view("SearchResult", employees);
}
EDIT: Just read your comments and if I understand correctly, you're only interested in the id's. Are you using those in javascript, and is this some kind of ajax call ? In that case you might want to return an array, or a csv string and deal with the id's in the javascript call.