public async Task <WalletWidthdrawalResponse> AddWalletWidthdrawalRequest(int request_initiator_id, string comment) { WalletWidthdrawalResponse response = new WalletWidthdrawalResponse(); response = await _common.AddWalletWidthdrawalRequest(request_initiator_id, comment); return(response); }
public async Task <WalletWidthdrawalResponse> AddWalletWidthdrawalRequest(int request_initiator_id, string comment) { WalletWidthdrawalResponse walletWidthdrawalResponse = new WalletWidthdrawalResponse(); Console.WriteLine("Connect to SQL Server and demo Create, Read, Update and Delete operations."); Console.Write("Connecting to SQL Server ... "); using (SqlConnection connection = new SqlConnection(this._connectionString)) { connection.Open(); Console.WriteLine("Done."); using (SqlCommand command = new SqlCommand("wallet_withdrawal_request", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@request_initiator_id", SqlDbType.Int).Value = request_initiator_id; command.Parameters.Add("@comment", SqlDbType.NVarChar).Value = comment; command.Parameters.Add("@widthdrawal_amount", SqlDbType.Decimal, 123); command.Parameters["@widthdrawal_amount"].Direction = ParameterDirection.Output; command.Parameters.Add("@return_message", SqlDbType.NVarChar, 1233232); command.Parameters["@return_message"].Direction = ParameterDirection.Output; try { await command.ExecuteNonQueryAsync(); { walletWidthdrawalResponse.amount_wallet_widthdraw = (decimal)command.Parameters["@widthdrawal_amount"].Value; walletWidthdrawalResponse.message = (string)command.Parameters["@return_message"].Value; } } catch (Exception ex) { throw ex; } } } Console.WriteLine("All done. Press any key to finish..."); return(walletWidthdrawalResponse); }
public async Task <ActionResult> AddWalletWidthdrawalRequest(int requestInitiatorId, string comment) { WalletWidthdrawalResponse response = await rs.AddWalletWidthdrawalRequest(requestInitiatorId, comment); return(Ok(response)); }