Пример #1
0
        public async Task <IActionResult> CurrencyPurchase(Purchase purchase)
        {
            purchase.Currency = purchase.Currency.ToUpper();
            string[] currencies = { "USD", "BRL" };
            if (_context.ValidateCurrency(purchase.Currency))
            {
                try
                {
                    var transaction = await(_context.CurrencyPurchase(purchase));
                    return(Ok(transaction));
                }
                catch (System.Exception e)
                {
                    return(BadRequest(e));

                    throw;
                }
            }
            else
            {
                return(BadRequest("Currency not found!"));
            }
        }