Add: CSV import with Replace All feature and auto-create categories
- Added Replace All checkbox to import UI for clean slate imports - Implemented DeleteAllProductsAndCategoriesAsync for complete data wipe - Added auto-creation of categories during CSV import - Created products_import.csv with 13 products across 4 categories - Added comprehensive IMPORT_INSTRUCTIONS.md documentation Technical changes: - ProductImportService: Added replaceAll parameter to all import methods - ProductImportService: Categories now auto-created if missing from CSV - ProductsController: Added replaceAll parameter to Import action - Import.cshtml: Added Replace All checkbox with danger warnings Categories: Flour, Cereal, Vitamins, Herbal Products: 13 products with full variant pricing structures 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -199,7 +199,7 @@ public class ProductsController : Controller
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Import(IFormFile file)
|
||||
public async Task<IActionResult> Import(IFormFile file, bool replaceAll = false)
|
||||
{
|
||||
if (file == null || file.Length == 0)
|
||||
{
|
||||
@@ -216,7 +216,7 @@ public class ProductsController : Controller
|
||||
try
|
||||
{
|
||||
using var stream = file.OpenReadStream();
|
||||
var result = await _importService.ImportFromCsvAsync(stream);
|
||||
var result = await _importService.ImportFromCsvAsync(stream, replaceAll);
|
||||
|
||||
ViewData["ImportResult"] = result;
|
||||
return View("ImportResult", result);
|
||||
|
||||
Reference in New Issue
Block a user