UserManager<TUser, TKey>.AddToRoleAsync Method (TKey, String)
Adds a user to a role.
Namespace: Microsoft.AspNet.Identity
Assembly: Microsoft.AspNet.Identity.Core (in Microsoft.AspNet.Identity.Core.dll)
Syntax
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 Overridable Function AddToRoleAsync (
userId As TKey,
role As String
) As Task(Of IdentityResult)
Parameters
userId
Type: TKeyThe user ID.
role
Type: System.StringThe role.
Return Value
Type: System.Threading.Tasks.Task<IdentityResult>
The task representing the asynchronous operation.
See Also
UserManager<TUser, TKey> Class
Microsoft.AspNet.Identity Namespace
ASP.NET Identity
Return to top