UserManager<TUser>.AddToRoleAsync Method

Add 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 String, _
    role As String _
) As Task(Of IdentityResult)
'Usage
Dim instance As UserManager 
Dim userId As String 
Dim role As String 
Dim returnValue As Task(Of IdentityResult)

returnValue = instance.AddToRoleAsync(userId, _
    role)
public virtual Task<IdentityResult> AddToRoleAsync(
    string userId,
    string role
)
public:
virtual Task<IdentityResult^>^ AddToRoleAsync(
    String^ userId, 
    String^ role
)
abstract AddToRoleAsync : 
        userId:string * 
        role:string -> Task<IdentityResult> 
override AddToRoleAsync : 
        userId:string * 
        role:string -> Task<IdentityResult> 
public function AddToRoleAsync(
    userId : String, 
    role : String
) : Task<IdentityResult>

Parameters

Return Value

Type: System.Threading.Tasks.Task<IdentityResult>

See Also

Reference

UserManager<TUser> Class

Microsoft.AspNet.Identity Namespace