Esempio n. 1
0
 public FundsController(ILogger <FundsController> logger, IFundsTransferRepository orclRepo
                        , IAntiforgery antiforgery)
 {
     _logger      = logger;
     _orclRepo    = orclRepo;
     _antiforgery = antiforgery;
 }
 public FundsTransferController(ILogger <FundsTransferController> logger, IFundsTransferRepository orclRepo
                                , IOptions <AuthSettings> authSettings, IOptions <AppSettings> appSettings)
 {
     _logger       = logger;
     _orclRepo     = orclRepo;
     _authSettings = authSettings.Value;
     _appSettings  = appSettings.Value;
 }
        public FundsTransferRequestValidator(IFundsTransferRepository orclRepo)
        {
            _orclRepo = orclRepo;
            RuleFor(req => req.debitAccount)
            .NotNull()
            .NotEmpty()
            .MaximumLength(20);

            RuleFor(req => req.creditAccount)
            .NotNull()
            .NotEmpty()
            .MaximumLength(20);

            RuleFor(req => req.amount)
            .NotNull()
            .NotEmpty()
            .GreaterThan(0);

            RuleFor(req => req.narration)
            .NotNull()
            .NotEmpty()
            .MaximumLength(100);

            RuleFor(req => req.requestId)
            .NotNull()
            .NotEmpty()
            .MaximumLength(100)
            .SetValidator(new RequestIdValidator(_orclRepo));

            RuleFor(req => req.branchCode)
            .NotNull()
            .NotEmpty()
            .MaximumLength(100);

            RuleFor(req => req.userName)
            .NotNull()
            .NotEmpty()
            .MaximumLength(100);

            RuleFor(req => req.currency)
            .NotNull()
            .NotEmpty()
            .MaximumLength(100)
            .SetValidator(new CurrencyEnumValidator());
        }
 public RequestIdValidator(IFundsTransferRepository orclRepo)
     : base("Invalid or Duplicate {PropertyName}, {IdValue}.")
 {
     _orclRepo = orclRepo;
 }