public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email, Name = model.Name }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { List <KeyValuePair <string, string> > ErrorList = new List <KeyValuePair <string, string> >(); await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); Service.WalletService walletService = new Service.WalletService(); var curuser = UserManager.Users.Where(x => x.Email == model.Email).First(); walletService.CreateWallet(new Wallet { Owner = model.Email, Id = curuser.Id }, ref ErrorList); return(RedirectToAction("Index", "Home")); } AddErrors(result); } // Появление этого сообщения означает наличие ошибки; повторное отображение формы return(View(model)); }
protected override void Dispose(bool disposing) { if (disposing && _walletService != null) { _walletService.Dispose(); _walletService = null; } base.Dispose(disposing); }
public WalletController() { _walletService = new Service.WalletService(); }