fix validators. lat, long is nullable.

This commit is contained in:
Фролов 2022-02-01 17:55:56 +05:00
parent 9e546a4cfd
commit fc752e8f3b
3 changed files with 6 additions and 6 deletions

View File

@ -9,9 +9,9 @@ namespace AsbCloudInfrastructure.Validators
{
RuleFor(x => x.Caption).Length(1, 50)
.WithMessage("Допустимая длина названия от 1 до 50 символов");
RuleFor(x => x.Latitude).Must(lat => lat is <= 90 and >= -90)
RuleFor(x => x.Latitude).Must(l => l is null or <= 90 and >= -90)
.WithMessage("Допустимые значения широты от -90 до 90");
RuleFor(x => x.Longitude).Must(lat => lat is <= 180 and >= -180)
RuleFor(x => x.Longitude).Must(l => l is null or <= 180 and >= -180)
.WithMessage("Допустимые значения долготы от -180 до 180");
RuleFor(x => x.IdDeposit).GreaterThan(0)
.WithMessage("Id не может быть меньше 1");

View File

@ -9,9 +9,9 @@ namespace AsbCloudInfrastructure.Validators
{
RuleFor(x => x.Caption).Length(1, 50)
.WithMessage("Допустимая длина названия от 1 до 50 символов");
RuleFor(x => x.Latitude).Must(lat => lat is <= 90 and >= -90)
RuleFor(x => x.Latitude).Must(l => l is null or <= 90 and >= -90)
.WithMessage("Допустимые значения широты от -90 до 90");
RuleFor(x => x.Longitude).Must(lat => lat is <= 180 and >= -180)
RuleFor(x => x.Longitude).Must(l => l is null or <= 180 and >= -180)
.WithMessage("Допустимые значения долготы от -180 до 180");
}
}

View File

@ -7,9 +7,9 @@ namespace AsbCloudInfrastructure.Validators
{
public WellDtoValidator()
{
RuleFor(x => x.Latitude).Must(lat => lat is <= 90 and >= -90)
RuleFor(x => x.Latitude).Must(l => l is null or <= 90 and >= -90)
.WithMessage("Допустимые значения широты от -90 до 90");
RuleFor(x => x.Longitude).Must(lat => lat is <= 180 and >= -180)
RuleFor(x => x.Longitude).Must(l => l is null or <= 180 and >= -180)
.WithMessage("Допустимые значения долготы от -180 до 180");
}
}