public bool IsValid(string username, string password) { using (var db = new dbTravelCat()) // use your DbConext { // for the sake of simplicity I use plain text passwords // in real world hashing and salting techniques must be implemented return(db.member.Any(u => u.member_account == username && u.member_password == password)); } }