32 lines
1006 B
C#
32 lines
1006 B
C#
using cuqmbr.TravelGuide.Application.Common.Services;
|
|
using FluentValidation;
|
|
using Microsoft.Extensions.Localization;
|
|
|
|
namespace cuqmbr.TravelGuide.Application.Addresses.Commands.UpdateAddress;
|
|
|
|
public class UpdateAddressCommandValidator : AbstractValidator<UpdateAddressCommand>
|
|
{
|
|
public UpdateAddressCommandValidator(
|
|
IStringLocalizer localizer,
|
|
SessionCultureService cultureService)
|
|
{
|
|
RuleFor(v => v.Guid)
|
|
.NotEmpty()
|
|
.WithMessage(localizer["FluentValidation.NotEmpty"]);
|
|
|
|
RuleFor(v => v.Name)
|
|
.NotEmpty()
|
|
.WithMessage(localizer["FluentValidation.NotEmpty"])
|
|
.MaximumLength(64)
|
|
.WithMessage(
|
|
String.Format(
|
|
cultureService.Culture,
|
|
localizer["FluentValidation.MaximumLength"],
|
|
64));
|
|
|
|
RuleFor(v => v.CityGuid)
|
|
.NotEmpty()
|
|
.WithMessage(localizer["FluentValidation.NotEmpty"]);
|
|
}
|
|
}
|