public async Task <AddWalletTrnsactionResponse> AddWalletTransaction(double amount, int userId, string message, string transaction_mode)
        {
            AddWalletTrnsactionResponse response = new AddWalletTrnsactionResponse();

            response = await _common.AddWalletTransaction(amount, userId, message, transaction_mode);

            return(response);
        }
        public async Task <ActionResult> AddWalletTransaction()
        {
            double amount_wallet    = Convert.ToDouble(Request.Form["amount"]);
            int    userId           = Convert.ToInt32(Request.Form["userId"]);
            string message          = Convert.ToString(Request.Form["message"]);
            string transaction_mode = Convert.ToString(Request.Form["transactionMode"]);
            AddWalletTrnsactionResponse response = await rs.AddWalletTransaction(amount_wallet, userId, message, transaction_mode);

            return(Ok(response));
        }
Example #3
0
        public async Task <AddWalletTrnsactionResponse> AddWalletTransaction(double amount, int userId, string message, string transaction_mode)
        {
            AddWalletTrnsactionResponse addWalletTrnsactionResponse = new AddWalletTrnsactionResponse();

            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_transaction", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@AMOUNT_WALLET_FOR_REGISTRATION", SqlDbType.Decimal).Value = amount;
                    command.Parameters.Add("@user_id", SqlDbType.Int).Value               = userId;
                    command.Parameters.Add("@message", SqlDbType.NVarChar).Value          = message;
                    command.Parameters.Add("@transaction_mode", SqlDbType.NVarChar).Value = transaction_mode;
                    command.Parameters.Add("@returnMessage", SqlDbType.NVarChar, 1233232);
                    command.Parameters["@returnMessage"].Direction = ParameterDirection.Output;
                    try
                    {
                        await command.ExecuteNonQueryAsync();

                        {
                            addWalletTrnsactionResponse.message = (string)command.Parameters["@returnMessage"].Value;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            Console.WriteLine("All done. Press any key to finish...");
            return(addWalletTrnsactionResponse);
        }