This commit is contained in:
2021-01-07 19:13:13 +00:00
parent b52d4546bd
commit 7f23855bf8

View File

@@ -240,11 +240,22 @@ namespace AyaNova.Biz
//Name required BUT NOT REQUIRED TO BE UNIQUE
if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
AddError(ApiErrorCode.VALIDATION_REQUIRED, "name");
//test error on name
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "name", "test errror");
//if unit, it must both exist and belong to this CustomerId
if (proposedObj.UnitId != null)
{
if (!await ct.Unit.AnyAsync(z => z.Id == proposedObj.UnitId && z.CustomerId == proposedObj.CustomerId))
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "unitId", "Unit is not valid, it must exist and belong to the Customer");//no need to localize, this is for api users only as the UI should never allow this
}
}
//Any form customizations to validate?