20 lines
614 B
C#
20 lines
614 B
C#
using FluentValidation;
|
|
|
|
namespace MyNewProjectName.Application.Features.Sample.Commands.CreateSample;
|
|
|
|
/// <summary>
|
|
/// Validator for CreateSampleCommand
|
|
/// </summary>
|
|
public class CreateSampleCommandValidator : AbstractValidator<CreateSampleCommand>
|
|
{
|
|
public CreateSampleCommandValidator()
|
|
{
|
|
RuleFor(x => x.Name)
|
|
.NotEmpty().WithMessage("Name is required.")
|
|
.MaximumLength(200).WithMessage("Name must not exceed 200 characters.");
|
|
|
|
RuleFor(x => x.Description)
|
|
.MaximumLength(1000).WithMessage("Description must not exceed 1000 characters.");
|
|
}
|
|
}
|