Example #1
0
        public async Task <ActionResult <CryptoCurrency> > PostCurrency(CryptoCurrency cryptoCurrency)
        {
            ResponseDTO <CryptoCurrencyDTO> response = new ResponseDTO <CryptoCurrencyDTO>();
            ListDTO <CryptoCurrencyDTO>     list     = new ListDTO <CryptoCurrencyDTO>();

            list          = _currenciesManager.AddCryptoCurrency(cryptoCurrency);
            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));
        }
Example #2
0
 public async Task <ActionResult <Currency> > PostCurrency(CryptoCurrency cryptoCurrency)
 {
     _currenciesManager.AddCryptoCurrency(cryptoCurrency);
     return(Ok(_mapper.Map <IEnumerable <CurrencyDTO> >(cryptoCurrency)));
 }