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); }
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); }
public texchanx GetExchange(int ExchangeID) { texchanx exchange = dbConnection.texchanges.SingleOrDefault(o => o.EXCHANGEID == ExchangeID); return(exchange); }