diff --git a/Binner/Binner.Web/ClientApp/src/pages/Inventory.js b/Binner/Binner.Web/ClientApp/src/pages/Inventory.js index 7b427c52..bb88fe62 100644 --- a/Binner/Binner.Web/ClientApp/src/pages/Inventory.js +++ b/Binner/Binner.Web/ClientApp/src/pages/Inventory.js @@ -1974,21 +1974,26 @@ export function Inventory(props) {
- + {part.partId <= 0 ? You must save the part before adding custom suppliers to it. : Add a manual supplier entry}

} + trigger={} + />
{showAddPartSupplier && - - + + - - - + + + - + @@ -1996,13 +2001,13 @@ export function Inventory(props) { - + - + } diff --git a/Binner/Binner.Web/Controllers/PartController.cs b/Binner/Binner.Web/Controllers/PartController.cs index ee791845..f252a57e 100644 --- a/Binner/Binner.Web/Controllers/PartController.cs +++ b/Binner/Binner.Web/Controllers/PartController.cs @@ -570,6 +570,8 @@ public IActionResult BarcodePart([FromQuery] GetPartRequest request) [HttpPost("partSupplier")] public async Task CreatePartSupplierAsync(CreatePartSupplierRequest request) { + if (request.PartId <= 0) + return BadRequest("No partId specified."); return Ok(await _partService.AddPartSupplierAsync(Mapper.Map(request))); } @@ -581,6 +583,8 @@ public async Task CreatePartSupplierAsync(CreatePartSupplierReque [HttpPut("partSupplier")] public async Task UpdatePartSupplierAsync(UpdatePartSupplierRequest request) { + if (request.PartId <= 0) + return BadRequest("No partId specified."); return Ok(await _partService.UpdatePartSupplierAsync(Mapper.Map(request))); } @@ -592,6 +596,8 @@ public async Task UpdatePartSupplierAsync(UpdatePartSupplierReque [HttpDelete("partSupplier")] public async Task DeletePartSupplierAsync(DeletePartSupplierRequest request) { + if (request.PartSupplierId <= 0) + return BadRequest("No partSupplierId specified."); return Ok(await _partService.DeletePartSupplierAsync(new PartSupplier { PartSupplierId = request.PartSupplierId })); }