public double Convert(string source, string target, double sum) { double sourceValue = CurrencyBLInstance.getRate(source, DateTime.Now).Value; double targetValue = CurrencyBLInstance.getRate(target, DateTime.Now).Value; return(sum * (targetValue / sourceValue)); }
public RatesVM() { CurrencyInformationCollection = new List <CurrencyInformation>(); foreach (CurrencyInformation c in CurrencyInformation.ImportantCurrencies) { CurrencyRate rate = CurrencyBLInstance.getRate(c.Initials, DateTime.Now); CurrencyInformation information = new CurrencyInformation(c.Initials, c.Description, c.PathToImage); information.Rate = rate; information.Rate.Value = Math.Round(information.Rate.Value, 3); CurrencyInformationCollection.Add(information); } }