What method is correct if I wanted to use a variable in place of a model field attribute when searching a table?
var Variable = "name" //person has a name field
IEnumerable<person> person= db.person;
if (person.Any(item => item.Variable== "Bob"))
{
// do Stuff
}
What I am trying to do is use an ajax call on a form input field to check if it exists when input is detected, the ajax call will send through the input value and the name of the field.
I am trying to write the controller method in such a way that it is able to take 2 parameters and is reusable on all the form fields.