private static IEnumerable <M_StockWithPrice> AddPriceToStock(StockCollection stockCollection)
        {
            StockPriceLoader stockPriceLoader = new StockPriceLoader();

            return(stockCollection.EnumerateStocks()
                   .Select(stock => new M_StockWithPrice()
            {
                Stock = stock, Price = stockPriceLoader.Load(stock.Ticker)
            }));
        }
Beispiel #2
0
 public IEnumerable <StockValue> GetModel(
     IEnumerable <Stock> enumerateStocks)
 {
     return(enumerateStocks
            .Select(stock =>
                    new
     {
         Stock = stock,
         Price = _stockPriceLoader.Load(stock.Ticker)
     })
            .Select(t => new StockValue(t.Stock, t.Price, t.Stock.GetCurrentValue(t.Price), t.Stock.GetGain(t.Price))));
 }