20 lines
631 B
C#
20 lines
631 B
C#
using FluentValidation;
|
|
using Indotalent.Shared.Consts;
|
|
|
|
namespace Indotalent.Features.Thirdparty.VendorContact.Cqrs;
|
|
|
|
public class CreateVendorContactValidator : AbstractValidator<CreateVendorContactRequest>
|
|
{
|
|
public CreateVendorContactValidator()
|
|
{
|
|
RuleFor(x => x.Name)
|
|
.NotEmpty().WithMessage("Contact Name is required")
|
|
.MaximumLength(GlobalConsts.StringLengthShort);
|
|
|
|
RuleFor(x => x.VendorId)
|
|
.NotEmpty().WithMessage("Vendor is required");
|
|
|
|
RuleFor(x => x.EmailAddress)
|
|
.EmailAddress().When(x => !string.IsNullOrEmpty(x.EmailAddress));
|
|
}
|
|
} |