From 871076c9a0b536468b9c32a79ad8ca712bb31b5a Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 14 Jan 2021 19:32:08 +0000 Subject: [PATCH] --- server/AyaNova/biz/PartAssemblyBiz.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/AyaNova/biz/PartAssemblyBiz.cs b/server/AyaNova/biz/PartAssemblyBiz.cs index c067dc08..5089dace 100644 --- a/server/AyaNova/biz/PartAssemblyBiz.cs +++ b/server/AyaNova/biz/PartAssemblyBiz.cs @@ -272,6 +272,12 @@ namespace AyaNova.Biz } } + //no duplicate parts + //this would be caused by an API user not our UI so no need to translation + if (proposedObj.Items.GroupBy(z => z.PartId).Any(g => g.Count() > 1)) + { + AddError(ApiErrorCode.VALIDATION_FAILED, "Items", "Duplicate parts are not allowed in the items collection"); + } //Any form customizations to validate? var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(x => x.FormKey == AyaType.PartAssembly.ToString());