public EmailAccountDetailsValidator(IEmailAccountRules emailAccountRules, ISiteRules siteRules)
            : base(siteRules)
        {
            _emailAccountRules = emailAccountRules;

            RuleFor(c => c.Address)
            .NotEmpty().WithMessage("Email account address is required.")
            .Length(1, 250).WithMessage("Email account address length must be between 1 and 250 characters.")
            .EmailAddress().WithMessage("Email account address not valid.")
            .Must(HaveUniqueAddress).WithMessage("An email account with the same address already exists.");

            RuleFor(c => c.DisplayName)
            .Length(1, 100).WithMessage("Display name length must be between 1 and 100 characters.")
            .When(x => !string.IsNullOrWhiteSpace(x.DisplayName));

            RuleFor(c => c.Host)
            .NotEmpty().WithMessage("Host is required.")
            .Length(1, 250).WithMessage("Host length must be between 1 and 250 characters.");

            RuleFor(c => c.Port)
            .NotEmpty().WithMessage("Port is required.");

            RuleFor(c => c.UserName)
            .NotEmpty().WithMessage("Username is required.")
            .Length(1, 250).WithMessage("Username length must be between 1 and 250 characters.")
            .When(x => x.DefaultCredentials == false);

            RuleFor(c => c.Password)
            .NotEmpty().WithMessage("Password is required.")
            .Length(1, 250).WithMessage("Password length must be between 1 and 250 characters.")
            .When(x => x.DefaultCredentials == false);
        }
Пример #2
0
 public EmailAccountController(IDispatcher dispatcher,
                               IEmailAccountRules emailAccountRules,
                               IContextService contextService)
     : base(contextService)
 {
     _dispatcher        = dispatcher;
     _emailAccountRules = emailAccountRules;
 }
Пример #3
0
        public CreateEmailAccountValidator(IEmailAccountRules emailAccountRules, ISiteRules siteRules)
            : base(emailAccountRules, siteRules)
        {
            _emailAccountRules = emailAccountRules;

            RuleFor(c => c.Id)
            .Must(HaveUniqueId).WithMessage("An email account with the same id already exists.")
            .When(x => x.Id != Guid.Empty);
        }
Пример #4
0
        public CreateEmailAccountValidator(IEmailAccountRules emailAccountRules, ISiteRules siteRules)
            : base(emailAccountRules, siteRules)
        {
            _emailAccountRules = emailAccountRules;

            RuleFor(c => c.Id)
            .NotEmpty().WithMessage("Id is required.")
            .Must(HaveUniqueId).WithMessage("An email account with the same id already exists.");
        }
Пример #5
0
 public EmailAccountController(ICommandSender commandSender,
                               IQueryDispatcher queryDispatcher,
                               IEmailAccountRules emailAccountRules,
                               IContextService contextService)
     : base(contextService)
 {
     _commandSender     = commandSender;
     _queryDispatcher   = queryDispatcher;
     _emailAccountRules = emailAccountRules;
 }
Пример #6
0
 public EmailAccountController(IEmailAccountFacade emailAccountFacade,
                               ICommandSender commandSender,
                               IEmailAccountRules emailAccountRules,
                               IContextService contextService)
     : base(contextService)
 {
     _emailAccountFacade = emailAccountFacade;
     _commandSender      = commandSender;
     _emailAccountRules  = emailAccountRules;
 }
 public UpdateEmailAccountDetailsValidator(IEmailAccountRules emailAccountRules, ISiteRules siteRules)
     : base(emailAccountRules, siteRules)
 {
 }