public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
                var result = await UserManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {
//                    await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
                     var role = _roleRepository.GetRoleById(model.id);
                    await UserManager.AddToRoleAsync(user.Id, role.Name);
                    string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                  
                    var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");
                   
                    return RedirectToAction("Login", "Account");
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            model.RoleSelectListItems = GetRoles();
            return View(model);

        }
        public ActionResult Register()
        {
            var viewModel = new RegisterViewModel();
            viewModel.RoleSelectListItems = GetRoles();

            return View(viewModel);
          //  return View();
        }