/// <summary> /// Returns an TUser given the user's id. /// </summary> /// <param name="userId">The user's id.</param> /// <returns></returns> public IdentityUser GetUserById(Guid userId) { string commandText = "SELECT * FROM " + fullTableName + " WHERE " + FieldId.Quoted() + " = @id"; Dictionary <string, object> parameters = new Dictionary <string, object>() { { "@id", userId } }; var row = _database.Query(commandText, parameters); return(loadUser(GenericHelpers.AddToDictionary(row))); }
public Profiles GetProfileByUserId(string userId) { string commandText = "SELECT * FROM " + fullTableName + " WHERE " + FieldUserId.Quoted() + " = @userid"; Dictionary <string, object> parameters = new Dictionary <string, object>() { { "@userid", userId } }; var row = _database.Query(commandText, parameters); return(loadProfile(GenericHelpers.AddToDictionary(row))); }
public LoginCounts GetLoginCountById(string userId) { string commandText = "SELECT * FROM " + fullTableName + " WHERE " + FieldUserId.Quoted() + " = @id"; Dictionary <string, object> parameters = new Dictionary <string, object>() { { "@id", userId } }; var row = _database.Query(commandText, parameters);//.ExecuteQueryGetSingleRow return(loadLoginCount(GenericHelpers.AddToDictionary(row))); }
/// <summary> /// Returns a list of TUser instances given a user name. /// </summary> /// <param name="userName">User's name.</param> /// <returns></returns> public IdentityUser GetUserByUserName(string userName) { if (userName != null) { userName = userName.ToLower(); } //take in email field string commandText = "SELECT * FROM " + fullTableName + " WHERE lower(" + FieldEmail.Quoted() + ") = @name"; Dictionary <string, object> parameters = new Dictionary <string, object>() { { "@name", userName } }; var row = _database.Query(commandText, parameters); return(loadUser(GenericHelpers.AddToDictionary(row))); }
/// <summary> /// Returns a list of TUser instances given a user email. /// </summary> /// <param name="email">User's email address.</param> /// <returns></returns> public IdentityUser GetUserByEmail(string email) { //Due to PostgreSQL's case sensitivity, we have another column for the user name in lowercase. if (email != null) { email = email.ToLower(); } string commandText = "SELECT * FROM " + fullTableName + " WHERE " + FieldEmail.Quoted() + " = @email"; Dictionary <string, object> parameters = new Dictionary <string, object>() { { "@email", email } }; var row = _database.Query(commandText, parameters); return(loadUser(GenericHelpers.AddToDictionary(row))); }