Exemple #1
0
        private void DisplaySpecificTransfer(int transferIdInput, Dictionary <int, string> userDict)
        {
            Console.WriteLine("---------------------");
            Console.WriteLine(" Transfers Details   ");
            Console.WriteLine("---------------------");

            API_Transfer usersTransfer = transferService.GetSpecificTransfer(transferIdInput);

            //displays Transfer details
            Console.WriteLine();
            Console.WriteLine($"Id: {usersTransfer.TransferId}");
            Console.WriteLine($"From: {userDict[usersTransfer.AccountFrom]}");
            Console.WriteLine($"To: {userDict[usersTransfer.AccountTo]}");

            if (usersTransfer.TransferType == 1)
            {
                Console.WriteLine("Type: Request");
            }
            else
            {
                Console.WriteLine("Type: Send");
            }

            if (usersTransfer.TransferStatus == 1)
            {
                Console.WriteLine("Status: Pending");
                Console.WriteLine($"Amount: ${usersTransfer.Amount}");
                Console.WriteLine();
                Console.WriteLine("Do you want to approve this transfer?: Y/N (or press any other key to exit and return to the main menu)");
                string approvalAnswer = Console.ReadLine();
                if (approvalAnswer.ToLower() == "y")
                {
                    BalanceTransfer newbalanceTransfer = new BalanceTransfer(usersTransfer.AccountFrom, usersTransfer.AccountTo, usersTransfer.Amount, 1, 2, transferIdInput);
                    balanceTransferService.AcceptOrDeclineTransfer(newbalanceTransfer);
                }
                else if (approvalAnswer.ToLower() == "n")
                {
                    BalanceTransfer newbalanceTransfer = new BalanceTransfer(usersTransfer.AccountFrom, usersTransfer.AccountTo, usersTransfer.Amount, 1, 3, transferIdInput);
                    balanceTransferService.AcceptOrDeclineTransfer(newbalanceTransfer);
                }
            }
            else if (usersTransfer.TransferStatus == 2)
            {
                Console.WriteLine("Status: Approved");
                Console.WriteLine($"Amount: ${usersTransfer.Amount}");
            }
            else
            {
                Console.WriteLine("Status: Rejected");
                Console.WriteLine($"Amount: ${usersTransfer.Amount}");
            }

            Console.ReadLine();
            //ShowMainMenu();
        }