-
Notifications
You must be signed in to change notification settings - Fork 0
/
ContainerValidator.cs
31 lines (27 loc) · 1.17 KB
/
ContainerValidator.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using FluentValidation;
using PayCoreClassWork3.WebAPI.Dto.Concrete;
using PayCoreClassWork3.WebAPI.Utilities;
namespace PayCoreClassWork3.WebAPI.Validators
{
// ContainerDto sınıfına ait validasyon işlemleri.
// FluentValidation kütüphanesinden gelmektedir.
public class ContainerValidator : AbstractValidator<ContainerDto>
{
public ContainerValidator()
{
RuleFor(c => c.ContainerName)
.NotEmpty().WithMessage(SystemMessage.NOT_EMPTY)
.NotNull().WithMessage(SystemMessage.NOT_EMPTY)
.Length(3, 50).WithMessage(SystemMessage.NAME_LENGTH_ERROR);
RuleFor(c => c.Latitude)
.NotEmpty().WithMessage(SystemMessage.NOT_EMPTY)
.NotNull().WithMessage(SystemMessage.NOT_EMPTY);
RuleFor(c => c.Longitude)
.NotEmpty().WithMessage(SystemMessage.NOT_EMPTY)
.NotNull().WithMessage(SystemMessage.NOT_EMPTY);
RuleFor(c => c.VehicleId)
.NotEmpty().WithMessage(SystemMessage.NOT_EMPTY)
.NotNull().WithMessage(SystemMessage.NOT_EMPTY);
}
}
}