예제 #1
0
        public IActionResult AddAccount(int customerId, int accountType)
        {
            var rnd = new Random();

            string accountNumber;
            string accountName = $"Account #{rnd.Next(1, 100)}";
            double balance     = rnd.NextDouble() * 500 - 250;

            switch (accountType)
            {
            case 2:
                accountNumber = $"{rnd.Next(1, 10000)}-{rnd.Next(1, 10000)}-{rnd.Next(1, 10000)}-{rnd.Next(1, 10000)}";
                break;

            default:
                accountNumber = $"{rnd.Next(1, 1000)}-{rnd.Next(1, 1000)}-{rnd.Next(1, 10000)}";
                break;
            }

            var result = CustomerRepository.AddAccount(customerId, accountType, accountNumber, accountName, balance);

            return(new ObjectResult(result));
        }