示例#1
0
        public IActionResult TopUpBalance(CardOperationDTO cardOperationDTO)
        {
            if (!ModelState.IsValid)
            {
                _logger.LogWarning(HttpStatusCode.BadRequest.ToString());
                return(BadRequest(HttpStatusCode.BadRequest));
            }

            var result = _cardOperation.TopUpBalance(cardOperationDTO.Amount, cardOperationDTO.CardId);

            if (!result)
            {
                _logger.LogWarning(HttpStatusCode.BadRequest.ToString());
                return(BadRequest(HttpStatusCode.BadRequest));
            }

            return(Ok());
        }
示例#2
0
        public IActionResult TransferToCard(CardOperationDTO cardOperationDTO)
        {
            if (!ModelState.IsValid)
            {
                _logger.LogWarning(HttpStatusCode.BadRequest.ToString());
                return(BadRequest(HttpStatusCode.BadRequest));
            }

            var result = _cardOperation.TransferToCard(cardOperationDTO.Amount, cardOperationDTO.CardId, cardOperationDTO.NumberCardForTransfer);

            if (!result)
            {
                _logger.LogWarning(HttpStatusCode.BadRequest.ToString());
                return(BadRequest(HttpStatusCode.BadRequest));
            }

            return(Ok());
        }