using System.ComponentModel.DataAnnotations; using TightWiki.Models.DataModels; namespace TightWiki.Models.ViewModels.Admin { public partial class AccountProfileAccountViewModel { [Display(Name = "主题")] public string? Theme { get; set; } = string.Empty; public Guid UserId { get; set; } [Display(Name = "Email")] [Required(ErrorMessage = "邮箱地址为必填项")] public string EmailAddress { get; set; } = string.Empty; [Display(Name = "账号")] [Required(ErrorMessage = "账号为必填项")] public string AccountName { get; set; } = string.Empty; public string? Navigation { get; set; } = string.Empty; [Display(Name = "姓")] public string? LastName { get; set; } = string.Empty; [Display(Name = "名")] public string? FirstName { get; set; } [Display(Name = "时区")] [Required(ErrorMessage = "时区为必填项")] public string TimeZone { get; set; } = string.Empty; [Display(Name = "国家")] [Required(ErrorMessage = "国家为必填项")] public string Country { get; set; } = string.Empty; [Display(Name = "语言")] [Required(ErrorMessage = "语言为必填项")] public string Language { get; set; } = string.Empty; [Display(Name = "个人简介")] public string? Biography { get; set; } = string.Empty; [Display(Name = "邮箱确认?")] public bool EmailConfirmed { get; set; } public byte[]? Avatar { get; set; } public DateTime CreatedDate { get; set; } public DateTime ModifiedDate { get; set; } public int PaginationPageSize { get; set; } public int PaginationPageCount { get; set; } public string Role { get; set; } = string.Empty; public static AccountProfileAccountViewModel FromDataModel(AccountProfile model) { return new AccountProfileAccountViewModel { Theme = model.Theme, UserId = model.UserId, EmailAddress = model.EmailAddress, AccountName = model.AccountName, Avatar = model.Avatar, Biography = model.Biography, Country = model.Country, Language = model.Language, CreatedDate = model.CreatedDate, EmailConfirmed = model.EmailConfirmed, FirstName = model.FirstName, LastName = model.LastName, ModifiedDate = model.ModifiedDate, Navigation = model.Navigation, PaginationPageCount = model.PaginationPageCount, Role = model.Role, PaginationPageSize = model.PaginationPageSize, TimeZone = model.TimeZone }; } } }