public async Task <AddWalletResponse> AddWallet(string user_security_stamp) { AddWalletResponse response = new AddWalletResponse(); response = await _common.AddWallet(user_security_stamp); return(response); }
public async Task <AddWalletResponse> AddWallet(string user_security_stamp) { AddWalletResponse response = new AddWalletResponse(); 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("add_wallet", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@user_security_stamp", SqlDbType.NVarChar).Value = user_security_stamp; command.Parameters.Add("@message", SqlDbType.NVarChar, 1233232); command.Parameters["@message"].Direction = ParameterDirection.Output; command.Parameters.Add("@user_id", SqlDbType.Int, 123); command.Parameters["@user_id"].Direction = ParameterDirection.Output; command.Parameters.Add("@AMOUNT_WALLET_FOR_REGISTRATION", SqlDbType.Decimal, 123); command.Parameters["@AMOUNT_WALLET_FOR_REGISTRATION"].Direction = ParameterDirection.Output; try { await command.ExecuteNonQueryAsync(); { response.message = (string)command.Parameters["@message"].Value; response.user_id = (Int32)command.Parameters["@user_id"].Value; response.amount_wallet_for_registration = (decimal)command.Parameters["@AMOUNT_WALLET_FOR_REGISTRATION"].Value; } } catch (Exception ex) { throw ex; } } } Console.WriteLine("All done. Press any key to finish..."); return(response); }
public async Task <ActionResult> AddWallet(string user_security_stamp) { AddWalletResponse response = await rs.AddWallet(user_security_stamp); return(Ok(response)); }