2020-04-22 15:46:35 +02:00
|
|
|
using FluentValidation;
|
2020-09-08 16:15:39 +02:00
|
|
|
using zero.Core.Api;
|
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
|
|
|
{
|
2020-09-09 11:55:09 +02:00
|
|
|
public class CountryValidator : ZeroValidator<ICountry>
|
2020-04-22 15:46:35 +02:00
|
|
|
{
|
2020-09-09 11:02:22 +02:00
|
|
|
public CountryValidator(IBackofficeStore store)
|
2020-04-22 15:46:35 +02:00
|
|
|
{
|
2020-09-09 11:02:22 +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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|