using System;
using System.Data.Entity;

namespace Demo.Models
{
    public class StockContext : DbContext
    {

        public DbSet<StockPosition> Positions { get; set; }

    }

    public class SeedData : DropCreateDatabaseAlways<StockContext>
    {

        protected override void Seed(StockContext context)
        {
            base.Seed(context);

            LoadPositionsForMicrosoft(context);

        }
  
        /// <summary>
        /// Loads the positions for microsoft.
        /// </summary>
        private void LoadPositionsForMicrosoft(StockContext context)
        {

            context.Positions.Add(new StockPosition("14-Jun-13	34.55	34.4	34.25	34.69"));
            context.Positions.Add(new StockPosition("13-Jun-13	34.99	34.72	34.59	35.02"));
            context.Positions.Add(new StockPosition("12-Jun-13	35.14	35	34.85	35.27"));
            context.Positions.Add(new StockPosition("11-Jun-13	35.05	34.84	34.68	35.18"));
            context.Positions.Add(new StockPosition("10-Jun-13	35.51	35.47	35.14	35.65"));
            context.Positions.Add(new StockPosition("7-Jun-13	35.25	35.67	35.06	35.78"));
            context.Positions.Add(new StockPosition("6-Jun-13	34.84	34.96	34.49	35.11"));
            context.Positions.Add(new StockPosition("5-Jun-13	34.6	34.78	34.43	34.89"));
            context.Positions.Add(new StockPosition("4-Jun-13	35.62	34.99	34.77	35.74"));
            context.Positions.Add(new StockPosition("3-Jun-13	34.92	35.59	34.83	35.63"));
            context.Positions.Add(new StockPosition("31-May-13	34.82	34.9	34.79	35.28"));
            context.Positions.Add(new StockPosition("30-May-13	34.85	35.03	34.81	35.25"));
            context.Positions.Add(new StockPosition("29-May-13	34.74	34.88	34.57	35.02"));
            context.Positions.Add(new StockPosition("28-May-13	34.42	35.02	34.41	35.18"));
            context.Positions.Add(new StockPosition("24-May-13	33.92	34.27	33.9	34.28"));
            context.Positions.Add(new StockPosition("23-May-13	34.23	34.15	33.9	34.55"));
            context.Positions.Add(new StockPosition("22-May-13	34.79	34.61	34.36	34.84"));
            context.Positions.Add(new StockPosition("21-May-13	35.1	34.85	34.72	35.27"));
            context.Positions.Add(new StockPosition("20-May-13	34.73	35.08	34.68	35.1"));
            context.Positions.Add(new StockPosition("17-May-13	34.13	34.87	34.1	34.87"));
            context.Positions.Add(new StockPosition("16-May-13	33.64	34.08	33.55	34.15"));
            context.Positions.Add(new StockPosition("15-May-13	33.45	33.84	33.43	33.9"));
            context.Positions.Add(new StockPosition("14-May-13	32.86	33.53	32.8	33.53"));
            context.Positions.Add(new StockPosition("13-May-13	32.61	33.03	32.55	33.07"));
            context.Positions.Add(new StockPosition("10-May-13	32.67	32.69	32.32	32.72"));
            context.Positions.Add(new StockPosition("9-May-13	32.85	32.66	32.59	33"));
            context.Positions.Add(new StockPosition("8-May-13	33.07	32.99	32.65	33.24"));
            context.Positions.Add(new StockPosition("7-May-13	33.65	33.31	33.24	33.79"));
            context.Positions.Add(new StockPosition("6-May-13	33.42	33.75	33.25	33.91"));
            context.Positions.Add(new StockPosition("3-May-13	33.23	33.49	33.08	33.52"));

            context.SaveChanges();

        }

    }

}