public void AssignRoleToUser(ApplicationUser user, UserRoleType userRole)
 {
     if (!_userManager.IsInRoleAsync(user, userRole.ToString()).Result)
     {
         _userManager.AddToRoleAsync(user, userRole.ToString()).Wait();
     }
 }
        public static void AttachRole(User user, UserRoleType role)
        {
            var userStore   = new UserStore <User>(new CaiDbContext());
            var userManager = new UserManager <User>(userStore);

            userManager.AddToRole(user.Id, role.ToString());
        }
Ejemplo n.º 3
0
 public CreateUserParams(string userId, string password, string name, string mailAddress, UserRoleType roleType)
 {
     AddNewParam("userId", userId);
     AddNewParam("password", password);
     AddNewParam("name", name);
     AddNewParam("mailAddress", mailAddress);
     AddNewParam("roleType", roleType.ToString("D"));
 }