public Task AddStockAsync(CountryKind country, string stockId, string stockName, string stockExchangeName, string stockDescription, string stockExchangeID) { IEnumerable <IStock> stocks = StockTable.Where(a => a.Country == country && string.Equals(a.StockId, stockId, StringComparison.OrdinalIgnoreCase)); if (stocks.Any()) { return(Task.CompletedTask); } Stock stock = new Stock(country, stockId, stockName, stockExchangeID) { StockExchangeName = stockExchangeName, Description = stockDescription }; StockTable.Add(stock); return(Task.CompletedTask); }
public Task <IReadOnlyList <IStock> > GetStocksAsync(CountryKind country) { return(Task.FromResult <IReadOnlyList <IStock> >(StockTable.Where(a => a.Country == country).ToList())); }