From 28d8c2a7488ddf0ca3e8c9bb9dbd24775e1cff59 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 20 Oct 2025 19:15:27 +0200 Subject: [PATCH] order create fix --- .../Areas/Admin/Controllers/CustomOrderController.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs index 3cac73d..481c81c 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs @@ -178,7 +178,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers var order = new Order { OrderGuid = Guid.NewGuid(), - CustomOrderNumber = null, + CustomOrderNumber = "", CustomerId = customerId, CustomerLanguageId = customer.LanguageId ?? 1, CustomerTaxDisplayType = TaxDisplayType.IncludingTax, @@ -192,11 +192,12 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers }; var productDtosById = await _dbContext.ProductDtos.GetAllByIds(orderProducts.Select(op => op.Id)).ToDictionaryAsync(p => p.Id, prodDto => prodDto); - + var transactionSuccess = await _dbContext.TransactionSafeAsync(async _ => { await _orderService.InsertOrderAsync(order); - + order.CustomOrderNumber = order.Id.ToString(); + await _orderService.UpdateOrderAsync(order); foreach (var item in orderProducts) { //var product = await _productService.GetProductByIdAsync(item.Id);