/// <summary> /// Returns the role Id given a role name. /// </summary> /// <param name="roleName">Role's name.</param> /// <returns>Role's Id.</returns> public string GetRoleId(string roleName) { string roleId = null; string commandText = "SELECT Id FROM AspNetRoles WHERE Name = @name"; Dictionary <string, object> parameters = new Dictionary <string, object>() { { "@name", roleName } }; var result = _database.QueryValue(commandText, parameters); if (result != null) { return(Convert.ToString(result)); } return(roleId); }
/// <summary> /// Returns the role Id given a role name. /// </summary> /// <param name="roleName">Role's name.</param> /// <returns>Role's Id.</returns> public string GetRoleId(string roleName) { string roleId = null; string commandText = "SELECT " + fieldId.Quoted() + " FROM " + fullTableName + " WHERE " + fieldName.Quoted() + " = @name"; Dictionary <string, object> parameters = new Dictionary <string, object>() { { "@name", roleName } }; var result = _database.QueryValue(commandText, parameters); if (result != null) { return(Convert.ToString(result)); } return(roleId); }