title: Issue when editing a Users Role
body: <p>I'm following a Book which shows you how to edit a users role. Everything's working fine until I get to a line of code. I think it will be a pretty simple solution, however, I cannot figure it out.</p>
  
  <pre><code>var result = await _userManager.AddToRoleAsync(user.Id,
                      selectedRole.Except(userRoles).ToArray&lt;string&gt;());
  </code></pre>
  
  <p>The line of code above is returning an error:</p>
  
  <blockquote>
    <p>"Argument 2: cannot convert from 'string[]' to 'string'"</p>
  </blockquote>
  
  <p>In the book, it shows:</p>
  
  <pre><code>.ToArray&lt;string&gt;
  </code></pre>
  
  <p>However, in my line of code, it's just telling me to refactor to:</p>
  
  <pre><code>.ToArray());
  </code></pre>
  
  <p>Is there another way of converting to string? I'll post the code below, thanks.</p>
  
  <p>EDIT USER CODE</p>
  
  <pre><code>[HttpPost]
  [ValidateAntiForgeryToken]
  public async Task&lt;ActionResult&gt; EditUser(EditUserViewModel model, params string[]  selectedRole)
          {
              if (ModelState.IsValid)
              {
                  var user = await _userManager.FindByIdAsync(model.Id);
  
                  if (user == null)
                  {
                      return HttpNotFound();
                  }
  
                  user.UserName = model.UserName;
                  user.FirstName = model.FirstName;
                  user.LastName = model.LastName;
  
                  var userRoles = await _userManager.GetRolesAsync(user.Id);
  
                  selectedRole = selectedRole ?? new string[] { };
  
                  var result = await _userManager.AddToRoleAsync(user.Id,
                      selectedRole.Except(userRoles).ToArray&lt;string&gt;()); // may not be right
  
                  if (!result.Succeeded)
                  {
                      ModelState.AddModelError("", result.Errors.First());
                      return View();
                  }
  
                  result = await _userManager.RemoveFromRoleAsync(user.Id, userRoles.Except(selectedRole).ToArray().ToString()); // put to string
  
                  if (!result.Succeeded)
                  {
                      ModelState.AddModelError("", result.Errors.First());
                      return View();
                  }
  
                  return RedirectToAction("Index");
  
              }
  
              ModelState.AddModelError("", "Something's failed.");
              return View();
  
  
          }
  </code></pre>
  
  <p>EditUserViewModel</p>
  
  <pre><code>public class EditUserViewModel
      {
  
              public string Id { get; set; }
  
  
              [Required]
              [Display(Name = "Username")]
              public string UserName { get; set; }
  
              [Required(AllowEmptyStrings = false)]
              [Display(Name = "Email")]
              [EmailAddress]
              public string Email { get; set; }
              [Required]
              [Display(Name = "First Name")]
              [StringLength(50)]
              public string FirstName { get; set; }
              [Required]
              [Display(Name = "Last Name")]
              [StringLength(50)]
              public string LastName { get; set; }
  
  
              public IEnumerable&lt;SelectListItem&gt; RolesList { get; set; }
  
  
      }
  </code></pre>
  
  <p>EditUser View</p>
  
  <pre><code>&lt;div class="form-group"&gt;
          @Html.Label("Roles", new { @class = "control-label col-md-2" })
          &lt;span class="col-md-10"&gt;
              @foreach (var item in Model.RolesList)
              {
                  &lt;input type="checkbox" name="SelectedRole" value="@item.Value"
                         checked="@item.Selected" class="checkbox-inline" /&gt;
  
                         @Html.Label(item.Value, new { @class = "control-label" })
              }
  
            &lt;/span&gt;
         &lt;/div&gt;
  </code></pre>