//Store list of basic quotes
 public static void storeData(List <TestFinanceModel> vehicleList)
 {
     using (FinanceVehiclesDbContext context = new FinanceVehiclesDbContext())
     {
         context.FinanceModelSet.AddRange(vehicleList);
         context.SaveChanges();
     }
 }
 //Store basic quote data
 public static void storeData(TestFinanceModel vehicle)
 {
     using (FinanceVehiclesDbContext context = new FinanceVehiclesDbContext())
     {
         context.FinanceModelSet.Add(vehicle);
         context.SaveChanges();
     }
 }
 //Store list of monthly quotes
 public static void storeData(MonthlyFinanceTimeSeriesParentModel vehicle)
 {
     using (FinanceVehiclesDbContext context = new FinanceVehiclesDbContext())
     {
         context.MonthlyFinanceModelSet.AddRange(vehicle.monthlyFinanceTimeSeriesParentModel);
         context.SaveChanges();
     }
 }
示例#4
0
        public static void seedInitial(FinanceVehiclesDbContext context)
        {
            if (!context.FinanceModelSet.Any())
            {
                var investments = new List <TestFinanceModel>
                {
                    new TestFinanceModel("TSLA", 0, "0"),
                    new TestFinanceModel("VAB", 0, "0"),
                    new TestFinanceModel("VIDY", 0, "0"),
                    new TestFinanceModel("VNQ", 0, "0"),
                    new TestFinanceModel("VGH", 0, "0")
                };

                context.FinanceModelSet.AddRange(investments);
                context.SaveChanges();
            }
        }