using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using YBDevice.Entity; namespace YBDevice.NApi.Application.FamilyInfo { /// /// 家庭成员模式切换 /// public class FamilyTypeSetC2SDto:IValidatableObject { /// /// 家庭成员ID /// public int FamilyId { get; set; } /// /// 成员类型,参考FamilyType,1-成人,2-儿童 /// public FamilyType Type { get; set; } public IEnumerable Validate(ValidationContext validationContext) { if (FamilyId <= 0) { yield return new ValidationResult("请先选择家庭成员", new[] { nameof(FamilyId) }); } if (Type <= 0) { yield return new ValidationResult("成员类型未找到", new[] { nameof(Type) }); } } } }