コード例 #1
0
        public HttpResponseMessage GetMarkets()
        {
            MarketInfo objMarketInfo             = new MarketInfo();
            TransactionalInformation transaction = new TransactionalInformation();
            MarketBusinessService    marketBusinessService;

            objMarketInfo.IsAuthenicated = true;

            marketBusinessService = new MarketBusinessService(marketDataService);


            List <tmarket> markets = marketBusinessService.GetMarkets(out transaction);

            objMarketInfo.Markets       = markets;
            objMarketInfo.ReturnStatus  = transaction.ReturnStatus;
            objMarketInfo.ReturnMessage = transaction.ReturnMessage;

            if (transaction.ReturnStatus == true)
            {
                var response = Request.CreateResponse <MarketInfo>(HttpStatusCode.OK, objMarketInfo);
                return(response);
            }

            var badResponse = Request.CreateResponse <MarketInfo>(HttpStatusCode.BadRequest, objMarketInfo);

            return(badResponse);
        }
コード例 #2
0
        public HttpResponseMessage GetTrade(int tID)
        {
            TradeInfo objTradeInfo = new TradeInfo();
            TransactionalInformation transaction              = new TransactionalInformation();
            TradesBusinessService    tradesBusinessService    = new TradesBusinessService(tradesDataService);
            ExchangeBusinessService  exchangesBusinessService = new ExchangeBusinessService(exchangesDataService);
            MarketBusinessService    marketsBusinessService   = new MarketBusinessService(marketsDataService);

            objTradeInfo.IsAuthenicated = true;

            ttrade trade = tradesBusinessService.GetTrade(tID, out transaction);

            List <texchanx> exchanges = exchangesBusinessService.GetExchanges(out transaction);
            List <tmarket>  markets   = marketsBusinessService.GetMarkets(out transaction);

            objTradeInfo.Trade          = trade;
            objTradeInfo.Exchanges      = exchanges;
            objTradeInfo.Markets        = markets;
            objTradeInfo.IsAuthenicated = true;
            objTradeInfo.ReturnStatus   = transaction.ReturnStatus;
            objTradeInfo.ReturnMessage  = transaction.ReturnMessage;

            if (transaction.ReturnStatus == true)
            {
                var response = Request.CreateResponse <TradeInfo>(HttpStatusCode.OK, objTradeInfo);
                return(response);
            }

            var badResponse = Request.CreateResponse <TradeInfo>(HttpStatusCode.BadRequest, objTradeInfo);

            return(badResponse);
        }