public async Task <int> AddBillingAddress(string userId, BillingAddressDto billingAddressDto) { var user = await GetUserById(userId); if (user == null) { throw new AuthenticationException(); } var billingAddress = new BillingAddress { Address = billingAddressDto.Address, City = billingAddressDto.City, Country = billingAddressDto.Country, PostCode = billingAddressDto.PostCode, UserId = user.Id }; await Do(async() => await _context.BillingAddresses.AddAsync(billingAddress)); return(billingAddress.Id); }
public async Task <IActionResult> AddBillingAddress([FromBody] BillingAddressDto billingAddressDto) { return(await Create(nameof(CartController.Checkout), async() => await _userService.AddBillingAddress(User.Identity.GetUserId(), billingAddressDto))); }