예제 #1
0
        public void HandleMessage(object obj, string message)
        {
            //Debug.WriteLine(message);
            GetMarketResponse marketResponse = (GetMarketResponse)converter.Deserialize(typeof(GetMarketResponse), message, '|');

            marketUpdates.Add(marketResponse);
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
        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;
            }
        }