autobus-api_old/AutobusApi.Application/VehicleEnrollments/Commands/UpdateVehicleEnrollment/UpdateVehicleEnrollmentCommandValidator.cs

20 lines
725 B
C#

using FluentValidation;
namespace AutobusApi.Application.VehicleEnrollments.Commands.UpdateVehicleEnrollment;
public class UpdateVehicleEnrollmentCommandValidator : AbstractValidator<UpdateVehicleEnrollmentCommand>
{
public UpdateVehicleEnrollmentCommandValidator()
{
RuleFor(v => v.Id).GreaterThan(0);
RuleForEach(v => v.RouteAddressDetails).ChildRules(detail =>
{
detail.RuleFor(v => v.RouteAddressId).GreaterThan(0);
detail.RuleFor(v => v.TimeToNextAddress).GreaterThan(TimeSpan.Zero);
detail.RuleFor(v => v.CurrentAddressStopTime).GreaterThan(TimeSpan.Zero);
detail.RuleFor(v => v.CostToNextAddress).GreaterThan(0.0);
});
}
}