using System.ComponentModel.DataAnnotations;
namespace Dlhis.Basic.Organization.Request;
public class GainfoUploadFaceRequest : IValidatableObject
{
///
/// 用户档案号
///
[Required(ErrorMessage = "用户档案号")]
public string UserNo { get; set; }
///
/// 人脸照片
///
[Required(ErrorMessage = "人脸照片不能为空")]
public string Face { get; set; }
public IEnumerable Validate(ValidationContext validationContext)
{
bool v = true;
try
{
Convert.FromBase64String(Face);
}
catch (Exception)
{
v = false;
}
if (!v)
{
yield return new ValidationResult("人脸照片需要为Base64格式", new[] { nameof(Face) });
}
}
}