예제 #1
0
        private static void PayInRequest(string name, float amount)
        {
            Console.WriteLine($"Request to pay in for an account {name}");

            Console.WriteLine("Validate request");
            if (amount <= 0)
            {
                Console.WriteLine("Validation failed: Amount must be positive value.");
                return;
            }

            var account = _database.GetAccountByName(name);

            if (account == null)
            {
                Console.WriteLine("Validation failed: Account does not exist.");
                return;
            }

            Console.WriteLine("Validation succeeded - execute command.");
            _router.Send(new PayInCommand(account.Id, amount));
        }