This commit is contained in:
@@ -88,9 +88,11 @@ namespace AyaNova.Biz
|
||||
{
|
||||
//It's a simple property on the main object
|
||||
//use reflection to get the underlying value from the proposed object to be saved
|
||||
//issue the error on the *Models* property name to mirror how all other server error handling and validation works
|
||||
//so that client end consumes it properly (fieldkey is just for the UI and showing / hiding overall form values)
|
||||
object propertyValue = proposedObject.GetType().GetProperty(RequiredPropertyName).GetValue(proposedObject, null);
|
||||
if (propertyValue == null)
|
||||
biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, FF.FieldKey);
|
||||
biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, RequiredPropertyName);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -98,12 +100,12 @@ namespace AyaNova.Biz
|
||||
{
|
||||
if (((System.Collections.Generic.List<string>)propertyValue).Count == 0)
|
||||
{
|
||||
biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, FF.FieldKey);
|
||||
biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, RequiredPropertyName);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (string.IsNullOrWhiteSpace(propertyValue.ToString()))
|
||||
biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, FF.FieldKey);
|
||||
biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, RequiredPropertyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user