From 4f591418dfb1d54ca5d068adc697921f65fb0759 Mon Sep 17 00:00:00 2001 From: SysAdmin Date: Wed, 8 Oct 2025 15:36:04 +0100 Subject: [PATCH] Add: Replace All option to text import UI - Add replaceAll checkbox to ImportText view with warning - Pass replaceAll parameter to import service - Allows complete product catalog replacement via text import - Enhanced documentation for unit types and variant collections --- .../Admin/Controllers/ProductsController.cs | 4 ++-- .../Admin/Views/Products/ImportText.cshtml | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/LittleShop/Areas/Admin/Controllers/ProductsController.cs b/LittleShop/Areas/Admin/Controllers/ProductsController.cs index 6d123b8..fe03970 100644 --- a/LittleShop/Areas/Admin/Controllers/ProductsController.cs +++ b/LittleShop/Areas/Admin/Controllers/ProductsController.cs @@ -252,7 +252,7 @@ public class ProductsController : Controller [HttpPost] [ValidateAntiForgeryToken] - public async Task ImportText(string textContent, IFormFile? file) + public async Task ImportText(string textContent, IFormFile? file, bool replaceAll = false) { string importText = textContent; @@ -277,7 +277,7 @@ public class ProductsController : Controller try { - var result = await _importService.ImportFromHumanTextAsync(importText); + var result = await _importService.ImportFromHumanTextAsync(importText, replaceAll); ViewData["ImportResult"] = result; return View("ImportResult", result); } diff --git a/LittleShop/Areas/Admin/Views/Products/ImportText.cshtml b/LittleShop/Areas/Admin/Views/Products/ImportText.cshtml index f50254a..19612f8 100644 --- a/LittleShop/Areas/Admin/Views/Products/ImportText.cshtml +++ b/LittleShop/Areas/Admin/Views/Products/ImportText.cshtml @@ -56,6 +56,18 @@ +
+
+ + +
+
+ Warning: This will permanently delete ALL existing product data! This action cannot be undone. +
+
+