新增国家、州省地区的API
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class AddressModelValidator : AbstractValidator<AddressModel>
|
||||
{
|
||||
public AddressModelValidator()
|
||||
public AddressModelValidator(IStringLocalizer<AddressModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("请填写收件人信息");
|
||||
RuleFor(p => p.Email).EmailAddress().When(p => !string.IsNullOrEmpty(p.Email)).WithMessage("请填写你常用的邮箱地址");
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class AdminModelValidator : AbstractValidator<AdminModel>
|
||||
{
|
||||
public AdminModelValidator()
|
||||
public AdminModelValidator(IStringLocalizer<AdminModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Username).NotEmpty().WithMessage("用户名不能为空");
|
||||
RuleFor(p => p.Username).Length(2, 64).When(p => !string.IsNullOrEmpty(p.Username)).WithMessage("用户名长度必须再2-64个字符之间");
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class AreaModelValidator : AbstractValidator<AreaModel>
|
||||
{
|
||||
public AreaModelValidator(IStringLocalizer<AreaModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("请填名称信息");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using Atomx.Common.Enums;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class CategoryModelValidator : AbstractValidator<CategoryModel>
|
||||
{
|
||||
public CategoryModelValidator()
|
||||
public CategoryModelValidator(IStringLocalizer<CategoryModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("名称不能为空");
|
||||
RuleFor(p => p.ParentId).Must((p,id)=> ValidateParent(id,p)).WithMessage("不能选择自己做上级分类");
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class CorporationModelValidator : AbstractValidator<CorporationModel>
|
||||
{
|
||||
public CorporationModelValidator()
|
||||
public CorporationModelValidator(IStringLocalizer<CorporationModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("公司名称不能为空");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class CorporationStaffModelValidator : AbstractValidator<CorporationStaffModel>
|
||||
{
|
||||
public CorporationStaffModelValidator()
|
||||
public CorporationStaffModelValidator(IStringLocalizer<CorporationStaffModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Username).NotEmpty().WithMessage("用户名不能为空");
|
||||
RuleFor(p => p.Username).Length(2, 64).When(p => !string.IsNullOrEmpty(p.Username)).WithMessage("用户名长度必须再2-64个字符之间");
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class CountryModelValidator : AbstractValidator<CountryModel>
|
||||
{
|
||||
public CountryModelValidator(IStringLocalizer<CountryModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("请填名称信息");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class CurrencyModelValidator : AbstractValidator<CurrencyModel>
|
||||
{
|
||||
public CurrencyModelValidator()
|
||||
public CurrencyModelValidator(IStringLocalizer<CurrencyModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("请填写货币名称");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Common.Configuration;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class GeneralConfigValidator : AbstractValidator<GeneralConfig>
|
||||
{
|
||||
public GeneralConfigValidator()
|
||||
public GeneralConfigValidator(IStringLocalizer<GeneralConfigValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("网站名称不能为空");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class LanguageModelValidator : AbstractValidator<LanguageModel>
|
||||
{
|
||||
public LanguageModelValidator()
|
||||
public LanguageModelValidator(IStringLocalizer<LanguageModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Title).NotEmpty().WithMessage("请填写语言标题");
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("请填写语言名称");
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class LocaleResourceModelValidator : AbstractValidator<LocaleResourceModel>
|
||||
{
|
||||
public LocaleResourceModelValidator()
|
||||
public LocaleResourceModelValidator(IStringLocalizer<LocaleResourceModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("本地化多语言信息不能为空");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class ManufacturerModelValidator : AbstractValidator<ManufacturerModel>
|
||||
{
|
||||
public ManufacturerModelValidator()
|
||||
public ManufacturerModelValidator(IStringLocalizer<ManufacturerModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("名称不能为空");
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using Atomx.Common.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class MenuModelValidator : AbstractValidator<MenuModel>
|
||||
{
|
||||
public MenuModelValidator()
|
||||
public MenuModelValidator(IStringLocalizer<MenuModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("名称不能为空");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class ProductAddStockModelValidator : AbstractValidator<ProductAddStockModel>
|
||||
{
|
||||
public ProductAddStockModelValidator()
|
||||
public ProductAddStockModelValidator(IStringLocalizer<ProductAddStockModelValidator> localizer)
|
||||
{
|
||||
//RuleFor(p => p.Username).NotEmpty().WithMessage("用户名不能为空");
|
||||
//RuleFor(p => p.Username).Length(2, 64).When(p => !string.IsNullOrEmpty(p.Username)).WithMessage("用户名长度必须再2-64个字符之间");
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class ProductAttributeModelValidator : AbstractValidator<ProductAttributeModel>
|
||||
{
|
||||
public ProductAttributeModelValidator()
|
||||
public ProductAttributeModelValidator(IStringLocalizer<ProductAttributeModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("名称不能为空");
|
||||
RuleFor(p => p.Status).GreaterThan(0).WithMessage("请设置正确的状态");
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class ProductAttributeOptionModelValidator : AbstractValidator<ProductAttributeOptionModel>
|
||||
{
|
||||
public ProductAttributeOptionModelValidator()
|
||||
public ProductAttributeOptionModelValidator(IStringLocalizer<ProductAttributeOptionModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Value).NotEmpty().WithMessage("数值不能为空");
|
||||
RuleFor(p => p.Status).GreaterThan(0).WithMessage("请设置正确的状态");
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class ProductModelValidator : AbstractValidator<ProductModel>
|
||||
{
|
||||
public ProductModelValidator()
|
||||
public ProductModelValidator(IStringLocalizer<ProductModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Title).NotEmpty().WithMessage("商品标题不能为空");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class RoleModelValidator : AbstractValidator<RoleModel>
|
||||
{
|
||||
public RoleModelValidator()
|
||||
public RoleModelValidator(IStringLocalizer<RoleModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("角色名称不能为空");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Common.Entities;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class RoleValidator : AbstractValidator<Role>
|
||||
{
|
||||
public RoleValidator()
|
||||
public RoleValidator(IStringLocalizer<RoleValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("角色名称不能为空");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class SiteAppModelValidator : AbstractValidator<SiteAppModel>
|
||||
{
|
||||
public SiteAppModelValidator()
|
||||
public SiteAppModelValidator(IStringLocalizer<SiteAppModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("请填写网站应用名称");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class SpecificationAttributeModelValidator : AbstractValidator<SpecificationAttributeModel>
|
||||
{
|
||||
public SpecificationAttributeModelValidator()
|
||||
public SpecificationAttributeModelValidator(IStringLocalizer<SpecificationAttributeModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("名称不能为空");
|
||||
RuleFor(p => p.Status).GreaterThan(0).WithMessage("请设置正确的状态");
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class SpecificationAttributeOptionModelValidator : AbstractValidator<SpecificationAttributeOptionModel>
|
||||
{
|
||||
public SpecificationAttributeOptionModelValidator()
|
||||
public SpecificationAttributeOptionModelValidator(IStringLocalizer<SpecificationAttributeOptionModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Value).NotEmpty().WithMessage("数值不能为空");
|
||||
RuleFor(p => p.Status).GreaterThan(0).WithMessage("请设置正确的状态");
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class StateProvinceValidator : AbstractValidator<StateProvinceModel>
|
||||
{
|
||||
public StateProvinceValidator(IStringLocalizer<StateProvinceValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("请填名称信息");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class UploadFileModelValidator : AbstractValidator<UploadFileModel>
|
||||
{
|
||||
public UploadFileModelValidator()
|
||||
public UploadFileModelValidator(IStringLocalizer<UploadFileModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("文件名称不能为空");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Common.Entities;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class UserValidator : AbstractValidator<User>
|
||||
{
|
||||
public UserValidator()
|
||||
public UserValidator(IStringLocalizer<UserValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("名称不能为空");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Atomx.Admin.Client.Validators
|
||||
{
|
||||
public class WarehouseModelValidator : AbstractValidator<WarehouseModel>
|
||||
{
|
||||
public WarehouseModelValidator()
|
||||
public WarehouseModelValidator(IStringLocalizer<WarehouseModelValidator> localizer)
|
||||
{
|
||||
RuleFor(p => p.Name).NotEmpty().WithMessage("用户名不能为空");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user