From 4dc3b4f7416a12e20849bb604ac0ad7478e91ad4 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GENO133\\IvanPlex" Date: Sun, 10 Mar 2024 09:05:15 -0600 Subject: [PATCH] fixed csv import --- Controllers/VehicleController.cs | 2 +- wwwroot/js/shared.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Controllers/VehicleController.cs b/Controllers/VehicleController.cs index 9c5dd0a..4f38bc6 100644 --- a/Controllers/VehicleController.cs +++ b/Controllers/VehicleController.cs @@ -503,7 +503,7 @@ namespace CarCareTracker.Controllers { VehicleId = vehicleId, Date = DateTime.Parse(importModel.Date), - InitialMileage = decimal.ToInt32(decimal.Parse(importModel.InitialOdometer, NumberStyles.Any)), + InitialMileage = string.IsNullOrWhiteSpace(importModel.InitialOdometer) ? 0 : decimal.ToInt32(decimal.Parse(importModel.InitialOdometer, NumberStyles.Any)), Mileage = decimal.ToInt32(decimal.Parse(importModel.Odometer, NumberStyles.Any)), Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes, Tags = string.IsNullOrWhiteSpace(importModel.Tags) ? [] : importModel.Tags.Split(" ").ToList() diff --git a/wwwroot/js/shared.js b/wwwroot/js/shared.js index 030b274..b49e09f 100644 --- a/wwwroot/js/shared.js +++ b/wwwroot/js/shared.js @@ -961,7 +961,7 @@ function saveUserColumnPreferences(importMode) { }); } function copyToClipboard(e) { - var textToCopy = e.textContent; + var textToCopy = e.textContent.trim(); navigator.clipboard.writeText(textToCopy); successToast("Copied to Clipboard"); } \ No newline at end of file