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

            objMarketInfo.IsAuthenicated = true;

            marketBusinessService = new MarketBusinessService(marketDataService);

            tmarket market = marketBusinessService.GetMarket(MarketID, out transaction);

            objMarketInfo.Market         = market;
            objMarketInfo.IsAuthenicated = true;
            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 tmarket GetMarket(int MarketID, out TransactionalInformation transaction)
        {
            transaction = new TransactionalInformation();
            tmarket market = new tmarket();

            try
            {
                marketDataService.CreateSession();
                market = marketDataService.GetMarket(MarketID);
                transaction.ReturnStatus = true;
            }
            catch (Exception ex)
            {
                transaction.ReturnMessage = new List <string>();
                string errorMessage = ex.Message;
                transaction.ReturnStatus = false;
                transaction.ReturnMessage.Add(errorMessage);
            }
            finally
            {
                marketDataService.CloseSession();
            }
            return(market);
        }
コード例 #3
0
        public tmarket GetMarket(int MarketID)
        {
            tmarket market = dbConnection.tmarkets.SingleOrDefault(o => o.MarketID == MarketID);

            return(market);
        }