public void HandleMessage(object obj, string message) { //Debug.WriteLine(message); GetMarketResponse marketResponse = (GetMarketResponse)converter.Deserialize(typeof(GetMarketResponse), message, '|'); marketUpdates.Add(marketResponse); }
public GetMarketResponse GetMarket(int marketId) { var response = new GetMarketResponse { MarketId = marketId }; using (var context = this.GetContext()) { var market = context.ExchangeMarkets.Find(marketId); if (market == null) { throw this.FaultFactory.CreateMarketNotFoundFaultException(marketId); } response.FromCurrencyId = market.FromCurrencyId; response.ToCurrencyId = market.ToCurrencyId; return response; } }
public GetMarketResponse GetMarket(string fromCurrencyId, string toCurrencyId) { var response = new GetMarketResponse { FromCurrencyId = fromCurrencyId, ToCurrencyId = toCurrencyId}; using (var context = this.GetContext()) { var market = context.ExchangeMarkets.FirstOrDefault( x => x.FromCurrencyId == fromCurrencyId && x.ToCurrencyId == toCurrencyId); if (market == null) { throw this.FaultFactory.CreateMarketNotFoundFaultException(fromCurrencyId, toCurrencyId); } response.MarketId = market.MarketId; return response; } }