public async Task <ActionResult> Register(RegisterViewModel model, string HoTen, string Email, string DienThoai, string Diachi) { if (ModelState.IsValid) { Account acc = new Account(); acc.UserName = model.UserName; acc.HoTen = HoTen; acc.Email = Email; acc.DiaChi = Diachi; acc.DienThoai = DienThoai; UserBus.Them(acc); var user = new ApplicationUser() { UserName = model.UserName }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInAsync(user, isPersistent : false); //await this.UserManager.AddToRoleAsync(user.Id, "12629e90-6c15-424b-abaa-164250682d15"); return(RedirectToAction("Index", "Home")); } else { AddErrors(result); } } // If we got this far, something failed, redisplay form //return RedirectToAction("Login", "Account"); return(View(model)); }