示例#1
0
        public ToolValidator(IToolboxService toolboxService)
        {
            RuleFor(x => x.VTFabrikat).NotNull();
            RuleFor(x => x.LiggerIvtk)
            .NotEmpty()
            .Custom((toolBoxId, context) =>
            {
                if (toolBoxId != null)
                {
                    var toolbox = toolboxService.GetToolbox(toolBoxId.Value);

                    if (toolbox.Result != null)
                    {
                        context.AddFailure("You must specify an existing toolbox");
                    }
                }
            });
        }