I'm new to Entity Framework and would like some help with my Read Methods.
I have this User
class and its UserDAO
with my methods.
I´ve already created
public IList<User> ReadUsersByName(string _name) {
var search = from m in context.Users
where m.Name.Contains(_name)
select m;
IList<User> _users = search.ToList();
return _users;
}
to search for Users by their name.
Other than Name, my Users have other attributes that I´d like to seach for (like their Age for example).
Do I need to replicate most of this code just changing "Name" for "Age"?
I´d like to create only one method and pass the Search Value AND Search Field by param. Is it possible?