Ejemplo n.º 1
0
        public async Task <ValidationResult> Handle(RemoveOFXCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                return(message.ValidationResult);
            }

            var OFX = await _OFXRepository.GetById(message.OFX.Id);

            if (OFX is null)
            {
                AddError("The OFX doesn't exists.");
                return(ValidationResult);
            }

            try
            {
                var stmttrnList = await _OFXRepository.GetSTMTTRNByAccountId(message.OFX.AccountId);

                _OFXRepository.RemoveSTMTTRNCollection(stmttrnList);

                OFX.BANKMSGSRSV1   = null;
                OFX.SIGNONMSGSRSV1 = null;

                _OFXRepository.Remove(OFX);
            }
            catch (Exception ex)
            {
                AddError(ex.Message);
                return(ValidationResult);
            }

            return(await Commit(_OFXRepository.UnitOfWork));
        }
Ejemplo n.º 2
0
 public async Task <List <STMTTRN> > GetSTMTTRNByAccountId(string accountId)
 {
     return(await _OFXRepository.GetSTMTTRNByAccountId(accountId));
 }