添加项目文件。

This commit is contained in:
2025-12-02 13:10:10 +08:00
parent 93a2382a16
commit 289aa4cbe7
400 changed files with 91177 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
using Atomx.Admin.Client.Models;
using FluentValidation;
namespace Atomx.Admin.Client.Validators
{
public class ManufacturerModelValidator : AbstractValidator<ManufacturerModel>
{
public ManufacturerModelValidator()
{
RuleFor(p => p.Name).NotEmpty().WithMessage("名称不能为空");
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<ManufacturerModel>.CreateWithOptions((ManufacturerModel)model, x => { x.IncludeProperties(propertyName); }));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}
}