public void UpdateCurrency(Currency currency) { var targetCurrency = _currencies.Find(c => c.CurrencyChar3Code == currency.CurrencyChar3Code.ToUpper()); _currencies.Remove(targetCurrency); _currencies.Add(currency); Persist(); }
public FlatFileCurrencyReferenceDataRepository(string fileName) { _fileName = fileName; _currencies = new List<Currency>(); string[] rawCurrencies = File.ReadAllLines(_fileName); foreach (var properties in rawCurrencies.Select(rawCurrency => rawCurrency.Split(','))) { var currency = new Currency { CurrencyName = properties[0], CurrencyChar3Code = properties[1], CurrencyNumberCode = Parse(properties[2]), }; int result; if(TryParse(properties[3], out result)) currency.NumberOfDigits = result; _currencies.Add(currency); } }
public void AddCurrency(Currency currency) { _currencies.Add(currency); Persist(); }