Add project data
This commit is contained in:
29
Tabletop.Core/Validators/TemplateValidator.cs
Normal file
29
Tabletop.Core/Validators/TemplateValidator.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using FluentValidation;
|
||||
using Tabletop.Core.Models;
|
||||
|
||||
namespace Tabletop.Core.Validators
|
||||
{
|
||||
public class TemplateValidator : AbstractValidator<Template>
|
||||
{
|
||||
public TemplateValidator()
|
||||
{
|
||||
RuleFor(x => x.Name)
|
||||
.NotEmpty()
|
||||
.WithMessage("The field must be filled")
|
||||
.MaximumLength(50)
|
||||
.WithMessage("Name must contain only 50 characters.");
|
||||
|
||||
RuleFor(x => x.FractionId)
|
||||
.NotEmpty()
|
||||
.WithMessage("Faction must be selected");
|
||||
|
||||
RuleFor(x => x.Force)
|
||||
.NotEmpty()
|
||||
.WithMessage("Force must be selected");
|
||||
|
||||
RuleFor(x => x.UsedForce)
|
||||
.LessThanOrEqualTo(x => x.Force)
|
||||
.WithMessage("Force points over limit");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user