예제 #1
0
        public async Task AddCardAsync(Card card, CancellationToken cancellationToken = default)
        {
            if (card == null)
            {
                throw new ArgumentNullException(nameof(card));
            }

            if (card.UserId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(card.UserId));
            }

            await cardRepository.AddAsync(card.CreateDtoCard());

            await userCardRepository.AddAsync(card.CreateUserCardDTO());

            await addressRepository.AddAsync(card.BillingAddress.CreateDtoAddress());
        }
예제 #2
0
        public async Task AddCardAsync(Card card, Guid userId)
        {
            if (card == null)
            {
                throw new ArgumentNullException(nameof(card));
            }

            if (userId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(userId));
            }

            var cardId = await cardRepository.AddAsync(card.CreateDtoCard());

            var addressId = await addressRepository.AddAsync(card.BillingAddress.CreateDtoAddress());

            await userCardRepository.AddAsync(userId.CreateUserCardDTO(cardId));

            await cardAddressRepository.AddAsync(cardId.CreateCardAddressDTO(addressId));
        }
예제 #3
0
 public async Task AddAddress()
 {
     await cardRepository.AddAsync(card);
 }