public ActionResult UserRoles(SelectUserRolesViewModel model)
 {
     if (ModelState.IsValid)
     {
         var idManager = new IdentityManager();
         var Db = new ApplicationDbContext();
         var user = Db.Users.First(u => u.UserName == model.UserName);
         idManager.ClearUserRoles(user.Id);
         foreach (var role in model.Roles)
         {
             if (role.Selected)
             {
                 idManager.AddUserToRole(user.Id, role.RoleName);
             }
         }
         return RedirectToAction("index");
     }
     return View();
 }
 public ActionResult UserRoles(string id)
 {
     var Db = new ApplicationDbContext();
     var user = Db.Users.First(u => u.UserName == id);
     var model = new SelectUserRolesViewModel(user);
     return View(model);
 }