Example #1
0
        public async Task <IHttpActionResult> GetStockPrice(int id)
        {
            Stock stock = await Db.Stocks.FindAsync(id);

            if (stock == null)
            {
                return(NotFound());
            }

            var price = await StockHelper.GetStockPrice(stock.Ticker);

            if (price < 0)
            {
                return(NotFound());
            }

            return(Ok(price));
        }
Example #2
0
 public async Task <float> GetCurrentPrice()
 {
     return(await StockHelper.GetStockPrice(Ticker));
 }