public Stock GetStock(string stockCode) { if (Stocks.Any(c => c.StockCode == stockCode)) { return(Stocks.First(c => c.StockCode == stockCode)); } return(null); }
private void gridControlProductLine_Click(object sender, EventArgs e) { if (!Stocks.Any()) { return; } GCProductDisplay.DataSource = Stocks.First(s => s.Id == (Guid)gridViewStock.GetFocusedRowCellValue("Id")) .Products.Where(p => p.Id == (Guid)gridViewProductLine.GetFocusedRowCellValue("IdProduct")); }
private void Initialize() { if (!Stocks.Any()) { Stocks.Add(new Stock { FreePlace = 500000, Name = "Stock 1" }); Stocks.Add(new Stock { FreePlace = 700000, Name = "Stock 2" }); Stocks.Add(new Stock { FreePlace = 900000, Name = "Stock 3" }); SaveChanges(); } }