I need to pass the ASP.NET Identity UserId as a parameter to a stored procedure, but I'm not sure how to get the ID from a logged in user?
Stored Procedure:
CREATE PROCEDURE [dbo].[GetUserProfile]
@UserId nvarchar(128)
AS
BEGIN
SELECT Avatar, City, [State]
FROM UserProfiles
WHERE UserId = @UserId
END
Stored Procedure call from Repository:
public List<UserModels.UserProfile> GetUserProfile()
{
using (var connection = new SqlConnection(SQLSettings.GetConnectionString()))
{
return connection.Query<UserModels.UserProfile>("GetUserProfile", commandType: CommandType.StoredProcedure).ToList();
}
}