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() }); }
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() }); }