Exemplo n.º 1
0
        static void CreateCustomer(AdminClient adminClient)
        {
            Prompt createCustomerPrompt = new Prompt("Create a new customer?", new string[] { "Y", "n" });

            createCustomerPrompt.Answered += (sender, e) => {
                if (e.answer.Equals("Y"))
                {
                    new Task(async() => {
                        var customer = await adminClient.CreateCustomer(new FunBankLib.Models.Customer()
                        {
                            Id           = null,
                            Hash         = null,
                            Username     = new Prompt("Username:"******"Password:"******"First Name:").Execute(),
                                Last  = new Prompt("Last Name:").Execute()
                            },
                            Address = new FunBankLib.Models.CustomerAddress()
                            {
                                Country     = new Prompt("Country: ").Execute(),
                                Postcode    = new Prompt("Postcode:").Execute(),
                                City        = new Prompt("City:").Execute(),
                                Street      = new Prompt("Street:").Execute(),
                                HouseNumber = new Prompt("House Number:").Execute()
                            }
                        });

                        CreateAccounts(adminClient, customer);
                    }).Start();
                }
                else
                {
                    CreateEmployee(adminClient);
                }
            };
            createCustomerPrompt.Execute();
        }