c# - Add User to ApplicationRole by RoleId -
i noticed when using usermanager
class, addtorole
method, can add users roles name, not role id. there way this? way system built, more 1 role may have same name. i'm looking like:
usermanager.addtorole(user.userid, role.roleid);
where addtorole
has arguments userid
, roleid
.
your role names should unique. if have role names same, how differentiate between them?
you use linq , name id roles.where(r => r.id == yourroleid).first().name
?
Comments
Post a Comment