order by id fix
This commit is contained in:
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.DTOs.Customers;
|
||||
using Webshop.Application.DTOs.Orders;
|
||||
using Webshop.Domain.Enums; // Wichtig für Enum-Konvertierung
|
||||
using Webshop.Domain.Interfaces;
|
||||
@@ -45,13 +46,32 @@ namespace Webshop.Application.Services.Admin
|
||||
OrderNumber = order.OrderNumber,
|
||||
OrderDate = order.OrderDate,
|
||||
CustomerId = order.CustomerId,
|
||||
// << KORREKTUR: String zu Enum parsen >>
|
||||
Status = Enum.TryParse<OrderStatus>(order.OrderStatus, true, out var orderStatus) ? orderStatus : OrderStatus.Pending,
|
||||
TotalAmount = order.OrderTotal,
|
||||
ShippingAddress = order.ShippingAddress, // Annahme: Address DTO Mapping
|
||||
BillingAddress = order.BillingAddress, // Annahme: Address DTO Mapping
|
||||
|
||||
// << KORREKTUR: Manuelles Mapping von Address-Entität zu AddressDto >>
|
||||
ShippingAddress = new AddressDto
|
||||
{
|
||||
Id = order.ShippingAddress.Id,
|
||||
Street = order.ShippingAddress.Street,
|
||||
HouseNumber = order.ShippingAddress.HouseNumber,
|
||||
City = order.ShippingAddress.City,
|
||||
PostalCode = order.ShippingAddress.PostalCode,
|
||||
Country = order.ShippingAddress.Country,
|
||||
Type = order.ShippingAddress.Type
|
||||
},
|
||||
BillingAddress = new AddressDto
|
||||
{
|
||||
Id = order.BillingAddress.Id,
|
||||
Street = order.BillingAddress.Street,
|
||||
HouseNumber = order.BillingAddress.HouseNumber,
|
||||
City = order.BillingAddress.City,
|
||||
PostalCode = order.BillingAddress.PostalCode,
|
||||
Country = order.BillingAddress.Country,
|
||||
Type = order.BillingAddress.Type
|
||||
},
|
||||
|
||||
PaymentMethod = order.PaymentMethod,
|
||||
// << KORREKTUR: String zu Enum parsen >>
|
||||
PaymentStatus = Enum.TryParse<PaymentStatus>(order.PaymentStatus, true, out var paymentStatus) ? paymentStatus : PaymentStatus.Pending,
|
||||
OrderItems = order.OrderItems.Select(oi => new OrderItemDto
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user