19 lines
476 B
C#
19 lines
476 B
C#
|
using Cloud.Requests;
|
|||
|
using FluentValidation;
|
|||
|
|
|||
|
namespace Cloud.Validation
|
|||
|
{
|
|||
|
public class FarmValidator : AbstractValidator<FarmRequest>
|
|||
|
{
|
|||
|
public FarmValidator()
|
|||
|
{
|
|||
|
RuleFor(request => request.RaspberryMacAddr)
|
|||
|
.NotEmpty().WithMessage("MAC address can't be empty")
|
|||
|
.Matches("^([0-9A-Fa-f]{2}[:-]?){5}([0-9A-Fa-f]{2})$").WithMessage("MAC address is not valid");
|
|||
|
|
|||
|
RuleFor(request => request.Name)
|
|||
|
.NotEmpty().WithMessage("Name can't be empty");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|