UserManager<TUser, TKey>.AddToRoleAsync Method
Adds a user to a role.
Namespace: Microsoft.AspNet.Identity
Assembly: Microsoft.AspNet.Identity.Core (in Microsoft.AspNet.Identity.Core.dll)
Syntax
'Declaration
Public Overridable Function AddToRoleAsync ( _
userId As TKey, _
role As String _
) As Task(Of IdentityResult)
'Usage
Dim instance As UserManager
Dim userId As TKey
Dim role As String
Dim returnValue As Task(Of IdentityResult)
returnValue = instance.AddToRoleAsync(userId, _
role)
public virtual Task<IdentityResult> AddToRoleAsync(
TKey userId,
string role
)
public:
virtual Task<IdentityResult^>^ AddToRoleAsync(
TKey userId,
String^ role
)
abstract AddToRoleAsync :
userId:'TKey *
role:string -> Task<IdentityResult>
override AddToRoleAsync :
userId:'TKey *
role:string -> Task<IdentityResult>
public function AddToRoleAsync(
userId : TKey,
role : String
) : Task<IdentityResult>
Parameters
- userId
Type: TKey
The user ID.
- role
Type: System.String
The role.
Return Value
Type: System.Threading.Tasks.Task<IdentityResult>
The task representing the asynchronous operation.
See Also
Reference
UserManager<TUser, TKey> Class
Microsoft.AspNet.Identity Namespace