namespace Yw.Application.Health
|
{
|
/// <summary>
|
/// 自动评价
|
/// </summary>
|
public class AutoEvaluation : Model.JsonModel<AutoEvaluation>, IValidatableObject
|
{
|
/// <summary>
|
/// 子项列表
|
/// </summary>
|
[Required]
|
public List<AutoEvaluationItem> Items { get; set; }
|
|
/// <summary>
|
///
|
/// </summary>
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
{
|
if (this.Items == null || this.Items.Count < 1)
|
{
|
yield return new ValidationResult(
|
"Items 不能为空"
|
, new[] { nameof(Items) }
|
);
|
}
|
else if (this.Items.Exists(x => x == null))
|
{
|
yield return new ValidationResult(
|
"Items 存在无效项"
|
, new[] { nameof(Items) }
|
);
|
}
|
}
|
}
|
}
|