You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.3 KiB
C#

using FluentValidation;
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 公告录入实体
/// </summary>
public class NoticeInput
{
public string Id { get; set; }
/// <summary>
/// 标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 优先级
/// </summary>
public string Level { get; set; } = "L";
/// <summary>
/// Desc:截至日期
/// Default:
/// Nullable:True
/// </summary>
public DateTime? EndTime { get; set; }
}
/// <summary>
/// 验证
/// </summary>
public class NoticeInputValidator : AbstractValidator<NoticeInput>
{
/// <summary>
/// 构造函数
/// </summary>
public NoticeInputValidator()
{
this.RuleFor(o => o.Title)
.NotEmpty().WithMessage("标题");
this.RuleFor(o => o.Content)
.NotEmpty().WithMessage("公告内容");
this.RuleFor(o => o.Type)
.NotEmpty().WithMessage("公告类型");
this.RuleFor(o => o.EndTime)
.NotEmpty().WithMessage("截止日期");
}
}