public async Task <ActionResult> CreateWallet() { try { BlockchainHttpClient httpClient = new BlockchainHttpClient(apicode, ApiURL); using (BlockchainApiHelper apiHelper = new BlockchainApiHelper(apicode, httpClient, "ApiURL", httpClient)) { var emailaddress = Session["Email_Address"] == null ? null : Session["Email_Address"].ToString(); var password = Session["Password"] == null ? null : Session["Password"].ToString(); if (string.IsNullOrEmpty(emailaddress) && string.IsNullOrEmpty(password)) { return(RedirectToAction("Login", "Account")); } else { WalletDetail ObjWalletViewModel = new WalletDetail(); var userid = db.AspNetUsers.Where(w => w.Email == emailaddress).Select(s => s.Id).FirstOrDefault(); CreateWalletResponse walletResponse = await apiHelper.walletCreator.CreateAsync(password, null, null, emailaddress); //apiHelper.walletCreator.CreateAsync("Kindle@123"); ObjWalletViewModel.GuidIdentifier = walletResponse.Identifier; ObjWalletViewModel.UserId = userid; ObjWalletViewModel.Address = walletResponse.Address; db.WalletDetails.Add(ObjWalletViewModel); db.SaveChanges(); return(RedirectToAction("Index")); } } } catch (Exception ex) { throw; } }
public void UpdateWalletDetail(WalletDetail walletDetail) { if (walletDetail == null) { throw new ArgumentNullException(nameof(walletDetail)); } _walletRepository.Update(walletDetail); //event notification _eventPublisher.EntityUpdated(walletDetail); }
public void DeleteWalletDetail(WalletDetail walletDetail) { if (walletDetail == null) { throw new ArgumentNullException(nameof(walletDetail)); } walletDetail.IsActive = false; UpdateWalletDetail(walletDetail); //event notification _eventPublisher.EntityDeleted(walletDetail); }
public async Task AddWalletDetails(Wallet wallet, WalletDetailsRequest walletDetails, string key) { //TODO: Validation var details = new WalletDetail(walletDetails) { Wallet = wallet }; _cryptoService.EncryptAsUser(details, key); await _walletDetailRepository.AddAsync(details); await _walletDetailRepository.SaveAsync(); }