Exemplo n.º 1
0
        public async Task <bool> MakeTransfer(Transfer transfer)
        {
            var sender   = JsonSerializer.Deserialize <Account>(await _redisDAL.GetHashOneAsync("Accounts", transfer.SenderAccountNumber));
            var receiver = JsonSerializer.Deserialize <Account>(await _redisDAL.GetHashOneAsync("Accounts", transfer.ReceiverAccountNumber));

            sender.Balance   -= transfer.Amount;
            receiver.Balance += transfer.Amount;

            return(await _accountDAL.MakeTransfer(transfer.SenderAccountNumber,
                                                  transfer.ReceiverAccountNumber,
                                                  JsonSerializer.Serialize(sender),
                                                  JsonSerializer.Serialize(receiver)));
        }