예제 #1
0
        public async Task <WithdrawalWallet> UpdateWalletWithdrawal(WithdrawalWallet withdrawalWalletModel)
        {
            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_update", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@withdrawal_id", SqlDbType.Int).Value         = withdrawalWalletModel.withdrawalid;
                    command.Parameters.Add("@is_approve", SqlDbType.Bit).Value            = withdrawalWalletModel.approved;
                    command.Parameters.Add("@is_rejected", SqlDbType.Bit).Value           = withdrawalWalletModel.rejected;
                    command.Parameters.Add("@approver_comment", SqlDbType.NVarChar).Value = withdrawalWalletModel.admincomment;
                    command.Parameters.Add("@return_message", SqlDbType.NVarChar, 1233232);
                    command.Parameters["@return_message"].Direction = ParameterDirection.Output;
                    try
                    {
                        await command.ExecuteNonQueryAsync();

                        {
                            var message = (string)command.Parameters["@return_message"].Value;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            Console.WriteLine("All done. Press any key to finish...");
            return(withdrawalWalletModel);
        }
        public async Task <List <WithdrawalWallet> > UpdateWalletWithdrawal(List <WithdrawalWallet> withdrawalWalletModels)
        {
            foreach (WithdrawalWallet withdrawalWalletModel in withdrawalWalletModels)
            {
                WithdrawalWallet response = await _common.UpdateWalletWithdrawal(withdrawalWalletModel);
            }


            return(withdrawalWalletModels);
        }