public void Post([FromBody] object jsonData)
        {
            // got to be an object to we can programatically deal with malformed or garbage data.

            try {
                var _tradeDataService = new TradeDataService(_tradeContext);
                var tradeMessage      = new OMSTradeDataMessage(jsonData.ToString());

                var result = _tradeDataService.CommitTrades(tradeMessage);

                // tradeservices.validate

                // handle and send to message bin
            }
            catch {
            }



            //            var toTrades = new List<OMSTradeData>(dataStream);



            //  _tradeDataService.CommitTrades(dataStream);
        }
Esempio n. 2
0
        public void BigFatDoEverything()
        {
            var optionsBuilder = new DbContextOptionsBuilder <TradeContext>();

            optionsBuilder.UseSqlServer("Server=.;Database=Redburn_Lofty1;Trusted_Connection = True;");

            var liveContext = new TradeContext(optionsBuilder.Options);

            //liveContext.Database.Migrate();
            liveContext.Database.EnsureCreated();   // shouldnt be necessary but for some reason db is not getting generated on savechanges. Investigate when given time.


            var tradeService = new TradeDataService(liveContext);


            var tradeStream  = _tradeDataStream.GetTradeStream();
            var tradeMessage = new OMSTradeDataMessage(tradeStream);

            var result = tradeService.CommitTrades(tradeMessage);


            Assert.True(result);
        }