Exemplo n.º 1
0
        public async Task <IActionResult> GetByIdAsync([Required] int id)
        {
            DigitalAccountModel digitalAccount = await _digitalAccountBusiness.GetByIdAsync(id);

            DigitalAccountResponseDTO response = _mapper.Map <DigitalAccountResponseDTO>(digitalAccount);

            return(Ok(response));
        }
        public async Task <IActionResult> CreateDigitalAccountAsync([FromBody] DigitalAccountRequestDTO digitalAccountRequest)
        {
            CustomerModel       customer       = _mapper.Map <CustomerModel>(digitalAccountRequest);
            DigitalAccountModel digitalAccount = await _digitalAccountBusiness.InsertAsync(customer);

            DigitalAccountResponseDTO response = _mapper.Map <DigitalAccountResponseDTO>(digitalAccount);

            return(Ok(response));
        }
        public async Task <IActionResult> GetDigitalAccountByCustomerAsync([Required] int customerId)
        {
            await _digitalAccountBusiness.Authorize(_accessToken);

            DigitalAccountModel digitalAccount = await _digitalAccountBusiness.GetDigitalAccountByCustomerIdAsync(customerId);

            DigitalAccountResponseDTO response = _mapper.Map <DigitalAccountResponseDTO>(digitalAccount);

            return(Ok(response));
        }