Esempio n. 1
0
        public async Task <ActionResult <CryptoCurrency> > GetCryptoCurrency(int id)
        {
            ResponseDTO <CryptoCurrencyDTO> response = new ResponseDTO <CryptoCurrencyDTO>();
            ListDTO <CryptoCurrencyDTO>     list     = new ListDTO <CryptoCurrencyDTO>();

            list          = _currenciesManager.GetCryptoCurrencyById(id);
            response.Data = new ListDTO <CryptoCurrencyDTO>();
            if (list != null)
            {
                response.Data    = list;
                response.Message = "List is retrieved successfully";
                response.Success = true;
                return(Ok(response));
            }
            response.Data    = null;
            response.Message = "List is not retrieved successfully";
            response.Success = false;

            return(NotFound(response));
        }
Esempio n. 2
0
        public async Task <ActionResult <CryptoCurrency> > GetCryptoCurrency(int id)
        {
            var cryptoCurrency = _currenciesManager.GetCryptoCurrencyById(id);

            return(Ok(_mapper.Map <IEnumerable <CryptoCurrencyDTO> >(cryptoCurrency)));
        }