Commits

Ben Foster committed dbb3b7a

Added interface for opening accounts

  • Participants
  • Parent commits dcd7205

Comments (0)

Files changed (1)

File CRUDDoBetter/Program.cs

             
             var bus = Configure.With()
                 .StructureMapBuilder()
-                .CreateDefaultBus(); // need to register bus with structuremap
+                .CreateDefaultBus();
 
-            var cmd = new OpenAccountCommand { AccountName = "Test", InitialBalance = 10M };
 
-            bus.Send(cmd);
+            string accountName;
+            decimal accountBalance;
+
+            Console.WriteLine("Enter account name:");
+
+            while ((accountName = Console.ReadLine()) != "exit")
+            {
+                Console.WriteLine("Enter account balance:");
+                accountBalance = decimal.Parse(Console.ReadLine());
+
+                var cmd = new OpenAccountCommand { AccountName = accountName, InitialBalance = accountBalance };
+                bus.Send(cmd);
+
+                Console.WriteLine("\nEnter Account Name:");
+            }
 
             Console.ReadLine();
         }