public CashController(ILogger <CashController> logger, ICashDepositRepository orclRepo , IAntiforgery antiforgery) { _logger = logger; _orclRepo = orclRepo; _antiforgery = antiforgery; }
public CashDepositRequestValidator(ICashDepositRepository orclRepo) { _orclRepo = orclRepo; 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.branchCode) .NotNull() .NotEmpty() .MaximumLength(100); RuleFor(req => req.userName) .NotNull() .NotEmpty() .MaximumLength(100); RuleFor(req => req.requestId) .NotNull() .NotEmpty() .MaximumLength(100) .SetValidator(new RequestIdValidator(_orclRepo)); RuleFor(req => req.debitAccount) .NotNull() .NotEmpty() .MaximumLength(20); RuleFor(req => req.currency) .NotNull() .NotEmpty() .MaximumLength(100) .SetValidator(new CurrencyEnumValidator()); }
public RequestIdValidator(ICashDepositRepository orclRepo) : base("Invalid or Duplicate {PropertyName}, {IdValue}.") { _orclRepo = orclRepo; }