Exemplo n.º 1
0
        public async Task <JsonResult> Transactions(Guid guid, string userName)
        {
            var request = new GameUserTransactionsQuery()
            {
                UserName = userName
            };
            var result = await _mediator.Send(request);

            return(new(result));
        }
Exemplo n.º 2
0
        public async Task <QueryResponseBO <List <GameTransactionsContract> > > Handle(GameUserTransactionsQuery request, CancellationToken cancellationToken)
        {
            var user = await _dataLayer.TblIdentityCredentials
                       .Where(i => i.UserName == request.UserName)
                       .FirstOrDefaultAsync(cancellationToken: cancellationToken);

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

            var result = await _dataLayer.FightTransactions
                         .Where(i => i.UserAuth.UserName == request.UserName)
                         .ToListAsync(cancellationToken: cancellationToken);

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