This commit is contained in:
Tizian.Breuch
2025-09-25 16:12:45 +02:00
parent c80b5ccc22
commit aaec80d7ad

View File

@@ -26,7 +26,6 @@ namespace Webshop.Application.Services.Customers
var customer = await _customerRepository.GetByUserIdAsync(userId); var customer = await _customerRepository.GetByUserIdAsync(userId);
if (customer == null) if (customer == null)
{ {
// If the customer profile doesn't exist for a valid user, return an empty list.
return ServiceResult.Ok<IEnumerable<AddressDto>>(new List<AddressDto>()); return ServiceResult.Ok<IEnumerable<AddressDto>>(new List<AddressDto>());
} }
@@ -67,8 +66,9 @@ namespace Webshop.Application.Services.Customers
var newAddress = new Address var newAddress = new Address
{ {
CustomerId = customer.Id, CustomerId = customer.Id,
FirstName = addressDto.FirstName ?? customer.FirstName, // << KORREKTUR: Namen vom Kundenprofil übernehmen, da sie im DTO nicht vorhanden sind. >>
LastName = addressDto.LastName ?? customer.LastName, FirstName = customer.FirstName,
LastName = customer.LastName,
Street = addressDto.Street, Street = addressDto.Street,
HouseNumber = addressDto.HouseNumber, HouseNumber = addressDto.HouseNumber,
City = addressDto.City, City = addressDto.City,