From dfe4e4f1abdcc32845b93b15838fda096a013849 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GENO133\\IvanPlex" Date: Sun, 11 Feb 2024 09:24:48 -0700 Subject: [PATCH] added check for missing supplies --- Controllers/VehicleController.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Controllers/VehicleController.cs b/Controllers/VehicleController.cs index 362dafa..fc37587 100644 --- a/Controllers/VehicleController.cs +++ b/Controllers/VehicleController.cs @@ -1493,7 +1493,11 @@ namespace CarCareTracker.Controllers { //get supply record. var supplyData = _supplyRecordDataAccess.GetSupplyRecordById(supply.SupplyId); - if (supply.Quantity > supplyData.Quantity) + if (supplyData == null) + { + result.Add("Missing Supplies, Please Delete This Template and Recreate It."); + } + else if (supply.Quantity > supplyData.Quantity) { result.Add($"Insufficient Quantity for {supplyData.Description}, need: {supply.Quantity}, available: {supplyData.Quantity}"); }