예제 #1
0
 public static CacheExchangeInfo FilterRatesByType(this CacheExchangeInfo exchangeInfo, ExchangeType type)
 {
     return(new CacheExchangeInfo
     {
         BaseType = exchangeInfo.BaseType,
         Published = exchangeInfo.Published,
         Expired = exchangeInfo.Expired,
         Rates = exchangeInfo.Rates
                 .Where(r => r.Type == type)
                 .ToList()
     });
 }
예제 #2
0
 public static RatesResponse ToRatesResponse(this CacheExchangeInfo exchangeInfo)
 {
     return(new RatesResponse
     {
         From = exchangeInfo.BaseType.ToString(),
         Rates = exchangeInfo.Rates
                 .Select(ei => new RateInfo
         {
             ExpireAt = exchangeInfo.Expired.DateTime,
             Rate = ei.Rate,
             To = ei.Type.ToString()
         }).ToArray()
     });
 }