feat: 增加模型约束条件

This commit is contained in:
Argo-Tianyi 2021-12-25 16:40:46 +08:00
parent 2eced5eadd
commit 55f673cacc
1 changed files with 5 additions and 0 deletions

View File

@ -47,6 +47,8 @@ namespace BootstrapAdmin.DataAccess.Models
/// <summary>
/// 获取/设置 密码
/// </summary>
[Display(Name = "密码")]
[Required(ErrorMessage = "{0}不可为空")]
public string? Password { get; set; }
/// <summary>
@ -87,6 +89,7 @@ namespace BootstrapAdmin.DataAccess.Models
/// 获得/设置 新密码
/// </summary>
[Display(Name = "新密码")]
[Required(ErrorMessage = "{0}不可为空")]
[NotNull]
public string? NewPassword { get; set; }
@ -94,6 +97,8 @@ namespace BootstrapAdmin.DataAccess.Models
/// 获得/设置 新密码
/// </summary>
[Display(Name = "确认密码")]
[Required(ErrorMessage = "{0}不可为空")]
[Compare("NewPassword", ErrorMessage = "{0}与{1}不一致")]
[NotNull]
public string? ConfirmPassword { get; set; }