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)); } }
/// <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); }
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()); }
public async Task AddAddress() { await addressRepository.AddAsync(address); }