Example #1
0
        public async Task AddUserInformationAsync(User user)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            var userId = await userRepository.AddAsync(UserMapping.CreateDtoUser(user));

            if (user.Address != null)
            {
                var addressId = await addressRepository.AddAsync(AddressMapping.CreateDtoAddress(user.Address));

                await userAddressesRepository.AddAsync(AddressMapping.CreateUserAddressDTO(userId, addressId));
            }
        }
Example #2
0
        /// <summary>
        /// store tenant infomation
        /// </summary>
        /// <param name="tenant">tenant object</param>
        public async Task StoreTenantAsync(Tenant tenant, CancellationToken cancellationToken = default)
        {
            NullCheckHelpers.EnsureArgumentIsNotNullOrEmpty(tenant);

            var addressId = await addressRepository.AddAsync(tenant.Address.CreateDtoAddress());

            await tenantRepository.AddAsync(tenant.CreateDtoTenant(addressId), cancellationToken);
        }
Example #3
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());
        }
Example #4
0
 public async Task AddAddress()
 {
     await addressRepository.AddAsync(address);
 }