예제 #1
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);
        }
        public HttpResponseMessage GetExchanges()
        {
            ExchangeInfo             objExchangeInfo = new ExchangeInfo();
            TransactionalInformation transaction     = new TransactionalInformation();
            ExchangeBusinessService  exchangeBusinessService;

            objExchangeInfo.IsAuthenicated = true;

            exchangeBusinessService = new ExchangeBusinessService(exchangeDataService);
            List <texchanx> exchanges = exchangeBusinessService.GetExchanges(out transaction);

            objExchangeInfo.Exchanges     = exchanges;
            objExchangeInfo.ReturnStatus  = transaction.ReturnStatus;
            objExchangeInfo.ReturnMessage = transaction.ReturnMessage;

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

            var badResponse = Request.CreateResponse <ExchangeInfo>(HttpStatusCode.BadRequest, objExchangeInfo);

            return(badResponse);
        }
        public HttpResponseMessage InitializeAPI(HttpRequestMessage request, [FromBody] APIInfo objAPIInfo)
        {
            TransactionalInformation transaction              = new TransactionalInformation();
            APIBusinessService       apiBusinessService       = new APIBusinessService(apiDataService);
            ExchangeBusinessService  exchangesBusinessService = new ExchangeBusinessService(exchangesDataService);

            objAPIInfo.IsAuthenicated = true;

            tkey key = apiBusinessService.GetAPI(objAPIInfo.KEYID, out transaction);

            List <texchanx> exchanges = exchangesBusinessService.GetExchanges(out transaction);

            objAPIInfo.Key           = key;
            objAPIInfo.Exchanges     = exchanges;
            objAPIInfo.ReturnStatus  = transaction.ReturnStatus;
            objAPIInfo.ReturnMessage = transaction.ReturnMessage;

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

            var badResponse = Request.CreateResponse <APIInfo>(HttpStatusCode.BadRequest, objAPIInfo);

            return(badResponse);
        }