public User ValidateUser(string username, string password) { using (AccountManagerEntities db = new AccountManagerEntities()) { User user=new User(); try { user = db.Users.Single(f => f.Username == username && f.Password == password); } catch { user = null; } return user; } }
public override bool ValidateUser(string username, string password) { using (AccountManagerEntities db = new AccountManagerEntities()) { var query = from p in db.Users where p.Username == username && p.Password == password select p; if(query.Count()!=0) { return true; } return false; } }