public async Task <Assignement> CreateUserAndDefaultAccount(Assignement assignement) { User user = assignement.User; Account account = assignement.Account; account.IsDefault = true; var fullUser = await userHelper.CreateUserAsync(user); var fullAccount = await accountHelper.CreateAccountAsync(account); List <string> accountsId = new List <string> { fullAccount.Id }; return(await userHelper.SetAssignementAsync(fullUser.Id, accountsId)); }
public async Task <IActionResult> NewAccountView(CreateAccount createAccount) { string ids = userId; TempData["Id"] = ids; Account accounts = await accountHelper.GetById(accountId); ViewBag.accountType = accounts.AccountType.ToString(); Account account = mapper.Map <Account>(createAccount); if (ModelState.IsValid) { var all = await accountHelper.CreateAccountAsync(account); return(RedirectToAction("ListAccounts")); } return(View()); }