コード例 #1
0
        public ForexModel MapToJsonModel(string updatedOn, IEnumerable <Rate> rates)
        {
            var currencyModels = new List <CurrencyModel>();

            foreach (var rate in rates)
            {
                var detailsModel = new CurrencyDetailsModel(rate.CurrencyCode, rate.CurrencyName);

                var rateModel = new CurrencyRateModel(
                    rate.BuyRate.ToDouble(),
                    rate.SellRate.ToDouble(),
                    rate.Multiply.ToInt()
                    );

                var guideModel = new CurrencyGuideModel(
                    rate.CurrencyGuide.From,
                    rate.CurrencyGuide.To,
                    rate.CurrencyGuide.Amount.ToInt(),
                    rate.CurrencyGuide.Value.ToDouble()
                    );

                var currencyModel = new CurrencyModel(detailsModel, rateModel, guideModel);

                currencyModels.Add(currencyModel);
            }

            var mappedModel = new ForexModel(DateTime.Parse(updatedOn), currencyModels);

            return(mappedModel);
        }
コード例 #2
0
 public IEnumerable <Currency> GetAllCurrencies()
 {
     currencyDetails = new CurrencyDetailsModel();
     return(currencyDetails.GetAllCurrencies());
 }