26 lines
878 B
C#
26 lines
878 B
C#
using FluentValidation;
|
|
using AdsBillingService.API.Application.Commands;
|
|
|
|
namespace AdsBillingService.API.Application.Validations;
|
|
|
|
/// <summary>
|
|
/// EN: Validator for CreateSampleCommand.
|
|
/// VI: Validator cho CreateSampleCommand.
|
|
/// </summary>
|
|
public class CreateSampleCommandValidator : AbstractValidator<CreateSampleCommand>
|
|
{
|
|
public CreateSampleCommandValidator()
|
|
{
|
|
RuleFor(x => x.Name)
|
|
.NotEmpty()
|
|
.WithMessage("Name is required / Tên là bắt buộc")
|
|
.MaximumLength(200)
|
|
.WithMessage("Name must be less than 200 characters / Tên phải ít hơn 200 ký tự");
|
|
|
|
RuleFor(x => x.Description)
|
|
.MaximumLength(1000)
|
|
.WithMessage("Description must be less than 1000 characters / Mô tả phải ít hơn 1000 ký tự")
|
|
.When(x => x.Description != null);
|
|
}
|
|
}
|