示例#1
0
        public void Run()
        {
            var request = new StoreCreditCard
            {
                CustomerId          = 1,
                Number              = "4111 1111 1111 1111",
                ExpirationDateYear  = (DateTime.UtcNow.Year + 1).ToString(),
                ExpirationDateMonth = "11",
                Name       = "Keith Palmer",
                Address    = "72 E Blue Grass Road",
                City       = "Willington",
                State      = "CT",
                PostalCode = "06279",
                Country    = "United States",
            };

            var result = _service.StoreCreditCard(request);

            if (!result.IsSuccess())
            {
                throw new Exception("Store credit card failed.");
            }

            Console.WriteLine("Credit card with id: " + result.Id);
        }
 private int StoreCreditCard(int customerId)
 {
     return(_creditCardsService.StoreCreditCard(new StoreCreditCard
     {
         CustomerId = customerId,
         Number = "4111 1111 1111 1111",
         ExpirationDateYear = (DateTime.UtcNow.Year + 1).ToString(),
         ExpirationDateMonth = "11",
         Name = "John Doe",
         Address = "72 E Blue Grass Road",
         City = "Willington",
         State = "CT",
         PostalCode = "06279",
         Country = "United States",
     }).Id);
 }