Example #1
0
        public async Task <IActionResult> Subscribe(string address)
        {
            if (!_addressValidator.IsValid(address))
            {
                return(BadRequest(ErrorResponse.Create("Invalid address")));
            }

            try
            {
                await _balanceService.Subscribe(address);
            }
            catch (BusinessException e) when(e.Code == ErrorCode.EntityAlreadyExist)
            {
                return(StatusCode(409));
            }

            return(Ok());
        }
Example #2
0
        public async Task <IActionResult> Subscribe(string address)
        {
            if (!_addressValidator.IsAddressValid(address))
            {
                return(BadRequest(ErrorResponse.Create("Invalid address")));
            }

            try
            {
                await _balanceService.Subscribe(address);
            }
            catch (WalletAlreadyExistException)
            {
                return(Conflict());
            }

            return(Ok());
        }