private async Task <FormModel> GetFormModel(string id) { UsersWalletsModel userWallet = await _usersWalletsService.GetUsersWalletsById(id); WalletModel wallet = await _walletService.GetWalletById(userWallet.WalletId.ToString()); UserModel user = await _userService.GetUserById(userWallet.UserId); FormModel model = new FormModel() { Id = user.Id, FullName = user.FirstName + " " + user.LastName, Sent = userWallet.WalletId, Amount = wallet.Amount, Type = wallet.Type }; return(model); }
//Get Create Wallet-address public async Task <IActionResult> CreateWallet() { IdentityUser user = await _userManager.FindByNameAsync(User.Identity.Name); Payments pc = new Payments(); APIResponse response = _repository.getAddress(pc); if (response.Status == "success") { UsersWalletsModel wallet = new UsersWalletsModel(); wallet.Address = (string)response.Data["address"]; wallet.User = user; _usersWalletRepository.CreateWalletAddress(wallet); return(RedirectToAction("Wallet")); } return(RedirectToAction("Index")); }
public void CreateWalletAddress(UsersWalletsModel wallet) { _db.UsersWallets.Add(wallet); _db.SaveChanges(); }