ValidateUser Method for Entity Framework MVC3 Razor Custom Member Provider C# Using LINQ
public override bool ValidateUser(string username, string password) { // PasswordFormat = Hashed byte[] hashedPassword = HashPassword(password.Trim()); // NKT: LINQ to Entities does not recognize // the method 'Int32 ToInt32(System.Object)' method, // and this method cannot be translated into a store expression. int userStatus = Convert.ToInt32(SSS.GlobalListValues.Enums.UserStatusCode.Active); using (var context = new SSSEntities()) { var query = from u in context.UserProfiles where u.UserName == username && u.UserPassword == hashedPassword && u.UserStatusCode == userStatus select u; bool isUserFound = false; foreach (var user in query.Take(1)) { isUserFound = true; } return isUserFound; } }
[SIGNATURE]