コード例 #1
0
        public HttpResponseMessage GetExchange(int ExchangeID)
        {
            ExchangeInfo             objExchangeInfo = new ExchangeInfo();
            TransactionalInformation transaction     = new TransactionalInformation();
            ExchangeBusinessService  exchangeBusinessService;

            objExchangeInfo.IsAuthenicated = true;

            exchangeBusinessService = new ExchangeBusinessService(exchangeDataService);
            texchanx exchange = exchangeBusinessService.GetExchange(ExchangeID, out transaction);

            objExchangeInfo.Exchange       = exchange;
            objExchangeInfo.IsAuthenicated = true;
            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);
        }
コード例 #2
0
        public texchanx GetExchange(int ExchangeID, out TransactionalInformation transaction)
        {
            transaction = new TransactionalInformation();
            texchanx exchange = new texchanx();

            try
            {
                exchangeDataService.CreateSession();
                exchange = exchangeDataService.GetExchange(ExchangeID);
                transaction.ReturnStatus = true;
            }
            catch (Exception ex)
            {
                transaction.ReturnMessage = new List <string>();
                string errorMessage = ex.Message;
                transaction.ReturnStatus = false;
                transaction.ReturnMessage.Add(errorMessage);
            }
            finally
            {
                exchangeDataService.CloseSession();
            }
            return(exchange);
        }
コード例 #3
0
        public texchanx GetExchange(int ExchangeID)
        {
            texchanx exchange = dbConnection.texchanges.SingleOrDefault(o => o.EXCHANGEID == ExchangeID);

            return(exchange);
        }