You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/projects/IoTNode/Application/Models/EditUserModel.cs

47 lines
1.7 KiB

using Infrastructure.Application;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace IoT.Shared.Application.Models
{
[Display(Name = "用户")]
public class EditUserModel : EditModel
{
[Required(ErrorMessage = nameof(RequiredAttribute))]
[RegularExpression("^[a-zA-Z0-9]+$", ErrorMessage = "")]
[StringLength(30, MinimumLength = 5, ErrorMessage = "用户名长度为5-30")]
[Display(Name = "用户名")]
public string UserName { get; set; }
[Description("编辑时不修改密码请保持为空")]
[StringLength(100, MinimumLength = 6, ErrorMessage = "密码长度范围为{2}-{1}")]
[DataType(DataType.Password)]
[Display(Name = "登录密码")]
public string Password { get; set; }
[DataType(DataType.EmailAddress)]
[RegularExpression(@"^\w+@\w+\.\w+$", ErrorMessage = "邮箱格式错误")]
[Display(Name = "邮箱")]
[Required(ErrorMessage = nameof(RequiredAttribute))]
public string Email { get; set; }
[Display(Name = "昵称")]
[MaxLength(24, ErrorMessage = "{0}最大长度为{1}")]
[Required(ErrorMessage = nameof(RequiredAttribute))]
public string NickName { get; set; }
[Display(Name = "头像")]
[DataType(DataType.ImageUrl)]
public string Avatar { get; set; }
[Display(Name = "已移除")]
public bool IsDeleted { get; internal set; }
[DataType("MultiSelectList")]
[Display(Name = "角色")]
public List<Guid> Roles { get; set; } = new List<Guid>();
}
}