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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

spring cloud - How to configure SpringCloud Eureka instance to point to https on non standard port -

javascript - Bootstrap Popover: iOS Safari strange behaviour -