38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 家庭成员模式切换
|
|
/// </summary>
|
|
public class FamilyTypeSetC2SDto:IValidatableObject
|
|
{
|
|
/// <summary>
|
|
/// 家庭成员ID
|
|
/// </summary>
|
|
public int FamilyId { get; set; }
|
|
/// <summary>
|
|
/// 成员类型,参考FamilyType,1-成人,2-儿童
|
|
/// </summary>
|
|
public FamilyType Type { get; set; }
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
if (FamilyId <= 0)
|
|
{
|
|
yield return new ValidationResult("请先选择家庭成员", new[] { nameof(FamilyId) });
|
|
}
|
|
if (Type <= 0)
|
|
{
|
|
yield return new ValidationResult("成员类型未找到", new[] { nameof(Type) });
|
|
}
|
|
}
|
|
}
|
|
}
|