Exemple #1
0
 public GetServerQueryValidator(IServerValidators validators)
 {
     RuleFor(r => r.ServerId)
     .MustAsync(validators.ServerExists)
     .WithMessage("Server does not exist!")
     .WithErrorCode(HttpStatusCode.NotFound.ToString());
 }
        public CreateChannelCommandValidator(IServerValidators validators)
        {
            RuleFor(c => c.ServerId)
            .MustAsync(validators.ServerExists)
            .WithMessage("Server does not exist!")
            .WithErrorCode(HttpStatusCode.NotFound.ToString());

            RuleFor(c => c.Input.Name)
            .NotNull()
            .NotEmpty();

            RuleFor(c => c.Input.Topic)
            .MaximumLength(1024);
        }