Example #1
0
        public async Task <JsonResult> Transactions(Guid guid, string userName, int walletId)
        {
            var request = new WalletTransactionsQuery()
            {
                Uid      = guid,
                UserName = userName,
                WalletId = walletId
            };
            var result = await _mediator.Send(request);

            return(new(result));
        }
Example #2
0
        public async Task <QueryResponseBO <List <WalletTransactionContract> > > Handle(WalletTransactionsQuery request, CancellationToken cancellationToken)
        {
            var result = await _dataLayer.TblUserWalletTransactions
                         .Where(i => i.SourceUserWalletId == request.WalletId)
                         .Where(i => i.UserAuth.UserName == request.UserName)
                         .Include(i => i.UserAuth)
                         .FirstOrDefaultAsync(cancellationToken: cancellationToken);

            if (result == null)
            {
                return(new()
                {
                    Message = "The requested resource was not found",
                    HttpStatusCode = HttpStatusCode.NotFound
                });
            }

            return(new()
            {
                HttpStatusCode = HttpStatusCode.Accepted,
                Response = result.Adapt <List <WalletTransactionContract> >()
            });
        }