public async Task <IActionResult> AddAccounts(Guid Id) { var accounts = await this.accountService.GetAllAccountsAsync(); var model = new AddAccountsViewModel { UserId = Id, Accounts = accounts.Accounts.Select(x => new SelectListItem(x.AccountNumber, x.Id.ToString())) }; return(PartialView("_AddAccounts", model)); }
public async Task <IActionResult> AddAccounts(AddAccountsViewModel model) { if (!this.ModelState.IsValid) { return(RedirectToAction("Index", "ErrorHandler")); } var account = await this.accountService.GetAccountByIdAsync(model.AccountId); var userAccount = await this.userService.AddAccountAsync(model.UserId, account.Id); return(RedirectToAction("AllUsers", "User")); }