예제 #1
0
        public async Task <ActionResult> GetBalance(Guid userId, EBalanceType type)
        {
            var userInfo = this.GetUserInfo();

            if (!userId.Equals(userInfo.UserId))
            {
                return(BadRequest("Invalid token."));
            }

            var command = new GetBalanceQuery(userInfo.UserId, userInfo.AccountId, type);

            var result = await _mediator.Send(command);

            if (result is null)
            {
                return(BadRequest("No balance found"));
            }

            return(Ok(result));
        }
 public GetBalanceQuery(Guid userId, Guid accountId, EBalanceType type)
 {
     AccountId = accountId;
     Type      = type;
     UserId    = userId;
 }