19 lines
622 B
C#
19 lines
622 B
C#
using FluentValidation;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ReserveManagementSystemUI.Model.Validators
|
|
{
|
|
public class TestModelValidator : AbstractValidator<TestModel>
|
|
{
|
|
|
|
public TestModelValidator()
|
|
{
|
|
RuleFor(tm => tm.YesResponse).NotEmpty().When(tm => tm.Action == "Yes").WithMessage("Yes response is required when yes action is selected.");
|
|
RuleFor(tm => tm.NoResponse).NotEmpty().When(tm => tm.Action == "No").WithMessage("No response is required when no action is selected.");
|
|
}
|
|
}
|
|
}
|