using Cloud.Requests; using FluentValidation; namespace Cloud.Validation { public class FarmValidator : AbstractValidator { 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"); } } }