public void RemoveStock(Stock stock) { if (Stocks.Exists(s => s.Symbol == stock.Symbol)) //If does exist, remove stock from list. { var StockToRemove = Stocks.Find(s => s.Symbol == stock.Symbol); Stocks.Remove(StockToRemove); } }
public MainWindowViewModel(ITrackerBusinessLogic trackerBusinessLogic) { try { this.trackerBusinessLogic = trackerBusinessLogic; Stocks = trackerBusinessLogic.GetStocks(); TradeTypes = trackerBusinessLogic.GetTradeTypes(); SelectedStock = Stocks.Find(s => s.Ticker == "MSFT"); Date = DateTime.Today; GetTradePortfolio(); } catch (Exception ex) { } }
private void MockProductTrigger() { foreach (var item in ChangeTracker.Entries <Product>().Where(x => x.State != EntityState.Unchanged).ToList()) { decimal delta = 0; var quantityProperty = item.Property(x => x.Price); switch (item.State) { case EntityState.Deleted: delta = -quantityProperty.CurrentValue; break; case EntityState.Added: delta = quantityProperty.CurrentValue; break; default: delta = quantityProperty.CurrentValue - quantityProperty.OriginalValue; break; } var stock = Stocks.Find(item.Entity.StockId); stock.TotalAmount += delta; } }
internal RonStock GetStock(string ticker) { return(Stocks.Find(stock => stock.Symbol == ticker)); }
public static int GetPriceOfStock(string name) { return(Stocks.Find(stock => stock.Name == name).CurrentStockPrice); }
public StockDTO GetStock(int ID) { return(Stocks.Find(ID)); }