From 09de55a64186a2b066948996684d5a1b87ad417d Mon Sep 17 00:00:00 2001 From: Argo-Tianyi Date: Wed, 5 Jan 2022 03:46:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B6=88=E9=99=A4=E8=AD=A6=E5=91=8A=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BootstrapAdmin.DataAccess.Models/Dict.cs | 8 ++++--- .../LoginUser.cs | 21 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Dict.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Dict.cs index bee4dcf0..e537d620 100644 --- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Dict.cs +++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Dict.cs @@ -19,21 +19,23 @@ public class Dict /// [Required(ErrorMessage = "{0}不可为空")] [Display(Name = "字典标签")] - public string Category { get; set; } = ""; + public string? Category { get; set; } /// /// 获得/设置 字典名称 /// [Required(ErrorMessage = "{0}不可为空")] [Display(Name = "字典名称")] - public string Name { get; set; } = ""; + [NotNull] + public string? Name { get; set; } /// /// 获得/设置 字典字典值 /// [Required(ErrorMessage = "{0}不可为空")] [Display(Name = "字典代码")] - public string Code { get; set; } = ""; + [NotNull] + public string? Code { get; set; } /// /// 获得/设置 字典定义值 0 表示系统使用,1 表示用户自定义 默认为 1 diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/LoginUser.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/LoginUser.cs index e612c1ff..76a1edde 100644 --- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/LoginUser.cs +++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/LoginUser.cs @@ -16,7 +16,8 @@ public class LoginLog /// 获得/设置 用户名 /// [DisplayName("登录名称")] - public string UserName { get; set; } = ""; + [NotNull] + public string? UserName { get; set; } /// /// 获得/设置 登录时间 @@ -28,35 +29,41 @@ public class LoginLog /// 获得/设置 登录IP地址 /// [DisplayName("主机")] - public string Ip { get; set; } = ""; + [NotNull] + public string? Ip { get; set; } /// /// 获得/设置 登录浏览器 /// [DisplayName("浏览器")] - public string Browser { get; set; } = ""; + [NotNull] + public string? Browser { get; set; } /// /// 获得/设置 登录操作系统 /// [DisplayName("操作系统")] - public string OS { get; set; } = ""; + [NotNull] + public string? OS { get; set; } /// /// 获得/设置 登录地点 /// [DisplayName("登录地点")] - public string City { get; set; } = ""; + [NotNull] + public string? City { get; set; } /// /// 获得/设置 登录是否成功 /// [DisplayName("登录结果")] - public string Result { get; set; } = ""; + [NotNull] + public string? Result { get; set; } /// /// 获得/设置 用户 UserAgent /// [DisplayName("登录名称")] - public string UserAgent { get; set; } = ""; + [NotNull] + public string? UserAgent { get; set; } }