From 1b60684f85abab1fcd94d0ff973b9f0217a8b4d5 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 6 Jun 2026 17:18:04 +0200 Subject: [PATCH] jjghjgh --- .../PreorderAdminController.Edit.cs | 38 +++++++++---------- .../Nop.Plugin.Misc.FruitBankPlugin.csproj | 3 ++ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/PreorderAdminController.Edit.cs b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/PreorderAdminController.Edit.cs index a13ac1c..07fbb88 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/PreorderAdminController.Edit.cs +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/PreorderAdminController.Edit.cs @@ -6,37 +6,37 @@ using Nop.Web.Framework.Mvc.Filters; namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers; -public partial class PreorderAdminController +public partial class PreOrderAdminController { - [HttpPost, Route("Admin/Preorders/UpdateHeader/{id:int}")] + [HttpPost, Route("Admin/PreOrders/UpdateHeader/{id:int}")] public async Task UpdateHeader(int id, string deliveryDateTime, string? customerNote) { if (!await _permissionService.AuthorizeAsync(StandardPermission.Security.ACCESS_ADMIN_PANEL)) return Forbid(); - var p = await _preorderDbContext.Preorders.GetByIdAsync(id); - if (p == null || p.Status == PreorderStatus.Cancelled) return Json(new { success = false }); + var p = await _preorderDbContext.PreOrders.GetByIdAsync(id); + if (p == null || p.Status == PreOrderStatus.Cancelled) return Json(new { success = false }); if (!DateTime.TryParse(deliveryDateTime, out var d)) return Json(new { success = false, error = "Érvénytelen dátum" }); p.DateOfReceipt = d; p.CustomerNote = customerNote?.Trim(); p.UpdatedOnUtc = DateTime.UtcNow; - await _preorderDbContext.Preorders.UpdateAsync(p); + await _preorderDbContext.PreOrders.UpdateAsync(p); return Json(new { success = true }); } - [HttpPost, Route("Admin/Preorders/UpdateItem/{id:int}")] + [HttpPost, Route("Admin/PreOrders/UpdateItem/{id:int}")] public async Task UpdateItem(int id, int quantity, decimal unitPrice) { if (!await _permissionService.AuthorizeAsync(StandardPermission.Security.ACCESS_ADMIN_PANEL)) return Forbid(); - var item = await _preorderDbContext.PreorderItems.GetByIdAsync(id); + var item = await _preorderDbContext.PreOrderItems.GetByIdAsync(id); if (item == null || item.FulfilledQuantity > 0) return Json(new { success = false, error = "Módosítás nem lehetséges" }); item.RequestedQuantity = Math.Max(1, quantity); item.UnitPriceInclTax = Math.Max(0, unitPrice); - await _preorderDbContext.PreorderItems.UpdateAsync(item); + await _preorderDbContext.PreOrderItems.UpdateAsync(item); return Json(new { success = true }); } - [HttpPost, Route("Admin/Preorders/ReplaceItemProduct/{id:int}")] + [HttpPost, Route("Admin/PreOrders/ReplaceItemProduct/{id:int}")] public async Task ReplaceItemProduct(int id, int newProductId) { if (!await _permissionService.AuthorizeAsync(StandardPermission.Security.ACCESS_ADMIN_PANEL)) return Forbid(); - var item = await _preorderDbContext.PreorderItems.GetByIdAsync(id); + var item = await _preorderDbContext.PreOrderItems.GetByIdAsync(id); if (item == null || item.FulfilledQuantity > 0) return Json(new { success = false, error = "Csere nem lehetséges" }); var product = await _dbContext.Products.GetByIdAsync(newProductId); if (product == null || product.Deleted) return Json(new { success = false, error = "Termék nem található" }); @@ -44,7 +44,7 @@ public partial class PreorderAdminController item.ProductId = newProductId; // Recalculate price for the preorder's customer using CustomPriceCalculationService - var preorder = await _preorderDbContext.Preorders.GetByIdAsync(item.PreorderId); + var preorder = await _preorderDbContext.PreOrders.GetByIdAsync(item.PreOrderId); var customer = preorder != null ? await _customerService.GetCustomerByIdAsync(preorder.CustomerId) : null; if (customer != null) { @@ -53,23 +53,23 @@ public partial class PreorderAdminController item.UnitPriceInclTax = calc.finalPrice; } - await _preorderDbContext.PreorderItems.UpdateAsync(item); + await _preorderDbContext.PreOrderItems.UpdateAsync(item); return Json(new { success = true, productName = product.Name, newPrice = item.UnitPriceInclTax }); } - [HttpPost, Route("Admin/Preorders/ConvertNow/{id:int}")] + [HttpPost, Route("Admin/PreOrders/ConvertNow/{id:int}")] public async Task ConvertNow(int id) { if (!await _permissionService.AuthorizeAsync(StandardPermission.Security.ACCESS_ADMIN_PANEL)) return Forbid(); - var preorder = await _preorderDbContext.Preorders.GetByIdAsync(id); - if (preorder == null || preorder.Status == PreorderStatus.Cancelled) + var preorder = await _preorderDbContext.PreOrders.GetByIdAsync(id); + if (preorder == null || preorder.Status == PreOrderStatus.Cancelled) return Json(new { success = false, error = "Konvertálás nem lehetséges" }); - var pending = await _preorderDbContext.PreorderItems.GetAll() - .Where(i => i.PreorderId == id && i.FulfilledQuantity < i.RequestedQuantity).ToListAsync(); + var pending = await _preorderDbContext.PreOrderItems.GetAll() + .Where(i => i.PreOrderId == id && i.FulfilledQuantity < i.RequestedQuantity).ToListAsync(); if (!pending.Any()) return Json(new { success = false, error = "Nincs teljesítetlen tétel" }); - await _preorderConversionService.ConvertPreordersForProductsAsync( + await _preorderConversionService.ConvertPreOrdersForProductsAsync( pending.Select(i => i.ProductId).Distinct().ToList(), 0); - var refreshed = await _preorderDbContext.Preorders.GetByIdAsync(id); + var refreshed = await _preorderDbContext.PreOrders.GetByIdAsync(id); return Json(new { success = true, orderId = refreshed?.OrderId }); } } diff --git a/Nop.Plugin.Misc.AIPlugin/Nop.Plugin.Misc.FruitBankPlugin.csproj b/Nop.Plugin.Misc.AIPlugin/Nop.Plugin.Misc.FruitBankPlugin.csproj index 60a98f2..94c4e7b 100644 --- a/Nop.Plugin.Misc.AIPlugin/Nop.Plugin.Misc.FruitBankPlugin.csproj +++ b/Nop.Plugin.Misc.AIPlugin/Nop.Plugin.Misc.FruitBankPlugin.csproj @@ -151,12 +151,15 @@ ..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\$(Configuration)\net9.0\Microsoft.AspNetCore.Http.Connections.Client.dll + True ..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\$(Configuration)\net9.0\Microsoft.AspNetCore.SignalR.Client.dll + True ..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\$(Configuration)\net9.0\Microsoft.AspNetCore.SignalR.Client.Core.dll + True ..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\$(Configuration)\net9.0\Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson.dll