mirror of
https://github.com/Sea-Haven-Industries/proposal-system.git
synced 2026-10-01 04:43:13 +00:00
20 lines
568 B
C#
20 lines
568 B
C#
|
|
using FluentValidation;
|
||
|
|
using ProposalSystem.Application.DTOs;
|
||
|
|
|
||
|
|
namespace ProposalSystem.Application.Validators;
|
||
|
|
|
||
|
|
public class UpdateCustomerValidator : AbstractValidator<UpdateCustomerRequest>
|
||
|
|
{
|
||
|
|
public UpdateCustomerValidator()
|
||
|
|
{
|
||
|
|
RuleFor(x => x.Name)
|
||
|
|
.MaximumLength(200)
|
||
|
|
.When(x => x.Name != null);
|
||
|
|
|
||
|
|
RuleFor(x => x.ContactEmail)
|
||
|
|
.EmailAddress().WithMessage("Contact email must be a valid email address")
|
||
|
|
.MaximumLength(320)
|
||
|
|
.When(x => !string.IsNullOrEmpty(x.ContactEmail));
|
||
|
|
}
|
||
|
|
}
|