Esempio n. 1
0
        static public QuoteEndpointModel vehicleFullPop(Dictionary <string, string> jsonDict)
        {
            QuoteEndpointModel modelToReturn = null;

            foreach (KeyValuePair <string, string> modelKeyPair in jsonDict)
            {
                var     deserializedData = jsonToAPIModel(modelKeyPair.Key, modelKeyPair.Value);
                dynamic modelToStore;
                switch (modelKeyPair.Key)
                {
                case "quote":
                    modelToReturn = (QuoteEndpointModel)deserializedData;
                    modelToStore  = new TestFinanceModel((QuoteEndpointModel)deserializedData);
                    break;

                case "daily":
                    modelToStore = new DailyFinanceTimeSeriesParentModel((TimeSeriesDailyModel)deserializedData);
                    break;

                case "weekly":
                    modelToStore = new WeeklyFinanceTimeSeriesParentModel((TimeSeriesWeeklyModel)deserializedData);
                    break;

                case "monthly":
                    modelToStore = new MonthlyFinanceTimeSeriesParentModel((TimeSeriesMonthlyModel)deserializedData);
                    break;

                default:
                    throw new InvalidOperationException();
                }
                EntityDataHandler.storeData(modelToStore);
            }
            return(modelToReturn);
        }
 public TestFinanceModel(QuoteEndpointModel quote)
 {
     this.MarketTicker     = quote.symbol;
     this.CurrentValue     = quote.open;
     this.PercentageChange = quote.change_percent;
 }