using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace YBDevice.NApi.Application.ThirdClient { /// /// 家庭成员信息修改 /// public class FamilySubmitC2SDto:BaseInfo,IValidatableObject { /// /// 主键,有则是修改 /// public Guid? Id { get; set; } /// /// 用户昵称 /// [Required(ErrorMessage ="昵称不可为空"),MaxLength(100,ErrorMessage ="昵称最多100个字")] public string Name { get; set; } /// /// 性别,1-男,2-女 /// public int Sex { get; set; } /// /// 出生年月 /// public DateTime Birthday { get; set; } public IEnumerable Validate(ValidationContext validationContext) { if(Birthday.Date > DateTime.Now.Date) { yield return new ValidationResult("出生年月不可大于今天", new string[] { nameof(Birthday) }); } } } /// /// 家庭成员信息 /// public class FamilyInfoS2CDto { /// /// 主键 /// public Guid Id { get; set; } /// /// 用户昵称 /// public string Name { get; set; } /// /// 头像 /// public string HeadImg { get; set; } /// /// 性别,1-男,2-女 /// public int Sex { get; set; } /// /// 出生年月 /// public DateTime? Birthday { get; set; } /// /// 年龄 /// public string Age { get; set; } } }