* fix formatting rules * reformat ersatztv * reformat ersatztv.application * reformat ersatztv.core * refactor ersatztv.core.tests * reformat ersatztv.ffmpeg * reformat ersatztv.ffmpeg.tests * reformat ersatztv.infrastructure * cleanup infra mysql * cleanup infra sqlite * cleanup infra tests * cleanup ersatztv.scanner * cleanup ersatztv.scanner.tests * sln cleanup * update dependencies
31 lines
966 B
C#
31 lines
966 B
C#
using ErsatzTV.Core.Domain;
|
|
using ErsatzTV.ViewModels;
|
|
using FluentValidation;
|
|
|
|
namespace ErsatzTV.Validators;
|
|
|
|
public class ProgramScheduleItemEditViewModelValidator : AbstractValidator<ProgramScheduleItemEditViewModel>
|
|
{
|
|
public ProgramScheduleItemEditViewModelValidator()
|
|
{
|
|
When(
|
|
i => i.StartType == StartType.Fixed,
|
|
() => RuleFor(i => i.StartTime).NotNull());
|
|
When(
|
|
i => i.PlayoutMode == PlayoutMode.Multiple,
|
|
() =>
|
|
{
|
|
When(
|
|
i => i.MultipleMode is MultipleMode.Count,
|
|
() => RuleFor(i => i.MultipleCount).NotNull().GreaterThan(0));
|
|
});
|
|
When(
|
|
i => i.PlayoutMode == PlayoutMode.Duration,
|
|
() =>
|
|
{
|
|
RuleFor(i => i.PlayoutDuration).NotNull();
|
|
RuleFor(i => i.DiscardToFillAttempts).NotNull().GreaterThanOrEqualTo(0);
|
|
});
|
|
}
|
|
}
|