public override string GetUserNameByEmail(string email) { using (MixupActivity.Context.AppContext dbContext = new MixupActivity.Context.AppContext()) { string username = (from u in dbContext.Persons where string.Compare(email, u.Email) == 0 select u.LoginId).FirstOrDefault(); return(!string.IsNullOrEmpty(username) ? username : string.Empty); } }
/// <summary> /// /// </summary> /// <param name="username"></param> /// <param name="userIsOnline"></param> /// <returns></returns> public override MembershipUser GetUser(string username, bool userIsOnline) { using (MixupActivity.Context.AppContext dbContext = new MixupActivity.Context.AppContext()) { var user = (from us in dbContext.Persons where string.Compare(username, us.LoginId, StringComparison.OrdinalIgnoreCase) == 0 select us).FirstOrDefault(); if (user == null) { return(null); } var selectedUser = new CustomMembershipUser(user); return(selectedUser); } }
public override bool ValidateUser(string username, string password) { if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { return(false); } using (MixupActivity.Context.AppContext dbContext = new MixupActivity.Context.AppContext()) { var user = (from us in dbContext.Persons where string.Compare(username, us.LoginId, StringComparison.OrdinalIgnoreCase) == 0 && string.Compare(password, us.Password, StringComparison.OrdinalIgnoreCase) == 0 select us).FirstOrDefault(); return((user != null) ? true : false); } }