コード例 #1
0
        /// <summary>
        /// Gets the user's name, provided with an ID.
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public String GetUserName(Guid userId)
        {
            const string commandText = "SELECT \"UserName\" FROM \"AspNetUsers\" WHERE \"Id\" = @id";
            var          parameters  = new Dictionary <String, Object>()
            {
                { "@id", userId }
            };

            return(_database.GetString(commandText, parameters));
        }
コード例 #2
0
        /// <summary>
        /// Returns a role name given the roleId.
        /// </summary>
        /// <param name="roleId">The role Id.</param>
        /// <returns>Role name.</returns>
        public String GetRoleName(String roleId)
        {
            String commandText = "SELECT \"Name\" FROM \"AspNetRoles\" WHERE \"Id\" = @id";
            Dictionary <String, Object> parameters = new Dictionary <String, Object>();

            parameters.Add("@id", roleId);

            return(_database.GetString(commandText, parameters));
        }