public void Sell(int amount, string code) { Wallet userWallet = walletRepository.GetUserWallet(Context.User.Identity.Name); Wallet marketWallet = walletRepository.GetMarketWallet(); TransactionErrorCode result = userWallet.Transfer(marketWallet, code, amount); walletRepository.Save(); Clients.User(Context.User.Identity.Name).completeTransaction(result, (WalletViewModel)userWallet); }
public void Buy(int amount, string code) { var userWallet = new Wallet(); TransactionErrorCode result = TransactionErrorCode.UnknownError; try { userWallet = walletRepository.GetUserWallet(Context.User.Identity.Name); Wallet marketWallet = walletRepository.GetMarketWallet(); result = marketWallet.Transfer(userWallet, code, amount); walletRepository.Save(); } catch { } Clients.User(Context.User.Identity.Name).completeTransaction(result, (WalletViewModel)userWallet); }