* Changed string parameters to GUID

This commit is contained in:
2025-02-01 07:14:29 +01:00
parent f996b668c2
commit 98777328d7
17 changed files with 43 additions and 48 deletions

View File

@@ -16,21 +16,21 @@ namespace SytelineSaAppEfDataModel.Services
return await context.CustomerOrders.Select(x => mapper.Map<CustomerOrderDto>(x)).ToListAsync();
}
public async Task<CustomerOrderDto?> GetByOrderNumber(string orderNumber)
public async Task<CustomerOrderDto?> GetByOrderNumber(Guid orderNumber)
{
CustomerOrderDto? customerOrder = await context.CustomerOrders
.Where(x => x.CoNum == orderNumber)
.Where(x => x.RowPointer == orderNumber)
.Select(x => mapper.Map<CustomerOrderDto>(x)).FirstOrDefaultAsync();
if (customerOrder == null) return null;
customerOrder.CustomerOrderLines = await context.CustomerOrderLines
.Where(x => x.CoNum == orderNumber)
.Where(x => x.CoNum == customerOrder.CoNum)
.Select(x => mapper.Map<CustomerOrderLineDto>(x)).ToListAsync();
foreach (CustomerOrderLineDto customerOrderLine in customerOrder.CustomerOrderLines)
{
customerOrderLine.CustomerOrderLineItems = await context.CustomerOrderLineItems
.Where(x => x.CoNum == orderNumber && x.CoLine == customerOrderLine.CoLine)
.Where(x => x.CoNum == customerOrder.CoNum && x.CoLine == customerOrderLine.CoLine)
.Select(x => mapper.Map<CustomerOrderLineItemDto>(x)).ToListAsync();
}