This commit is contained in:
2020-12-11 21:28:37 +00:00
parent b1b7f38b58
commit 4f43229a35

View File

@@ -213,21 +213,24 @@ namespace AyaNova.Biz
bool isNew = currentObj == null;
//Name required
//Name ("subject") is still required for a memo, empty subject not valid
//also, subject was required by biz rule in v7 so no need to worry about that on migrate
if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name does *NOT* need to be unique because for memo it's actually the subject line
//just kept internal naming the same to make coding easier with less workarounds
//If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name"))
{
//Use Any command is efficient way to check existance, it doesn't return the record, just a true or false
if (await ct.Memo.AnyAsync(m => m.Name == proposedObj.Name && m.Id != proposedObj.Id))
{
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "Name");
}
}
// //If name is otherwise OK, check that name is unique
// if (!PropertyHasErrors("Name"))
// {
// //Use Any command is efficient way to check existance, it doesn't return the record, just a true or false
// if (await ct.Memo.AnyAsync(m => m.Name == proposedObj.Name && m.Id != proposedObj.Id))
// {
// AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "Name");
// }
// }
//Any form customizations to validate?