2020-04-22 15:46:35 +02:00
|
|
|
using FluentValidation;
|
2021-10-11 15:15:55 +02:00
|
|
|
using zero.Core.Database;
|
2020-04-22 15:46:35 +02:00
|
|
|
using zero.Core.Entities;
|
2020-09-08 16:15:39 +02:00
|
|
|
using zero.Core.Extensions;
|
2020-11-19 00:14:52 +01:00
|
|
|
using zero.Core.Validation;
|
2020-04-22 15:46:35 +02:00
|
|
|
|
2020-11-19 00:14:52 +01:00
|
|
|
namespace zero.Core.Collections
|
2020-04-22 15:46:35 +02:00
|
|
|
{
|
2021-05-04 17:23:52 +02:00
|
|
|
public class CountryValidator : ZeroValidator<Country>
|
2020-04-22 15:46:35 +02:00
|
|
|
{
|
2021-10-28 12:11:07 +02:00
|
|
|
public CountryValidator(IZeroStore store)
|
2020-04-22 15:46:35 +02:00
|
|
|
{
|
2021-10-28 12:11:07 +02:00
|
|
|
RuleFor(x => x.Code).Length(2).Unique(store);
|
2020-04-22 15:46:35 +02:00
|
|
|
RuleFor(x => x.Name).Length(2, 120);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|