Ejemplo n.º 1
0
 public EditModel(MegaDeskWeb.Data.MegaDeskContext context)
 {
     _context = context;
 }
Ejemplo n.º 2
0
        public static void Initialize(MegaDeskContext context)

        {
            //checks if there is already materials in the database
            context.Database.EnsureCreated();
            if (context.Material.Any())

            {
                return;
                // DB has been seeded
            }

            var material = new Material[] {
                new Material
                {
                    Description = "Laminated",
                    Amount      = 100
                },
                new Material
                {
                    Description = "Oak",
                    Amount      = 200
                },
                new Material
                {
                    Description = "Rosewood",
                    Amount      = 300
                },
                new Material
                {
                    Description = "Veneer",
                    Amount      = 125
                },
                new Material
                {
                    Description = "Pine",
                    Amount      = 5
                }
            };

            foreach (Material m in material)
            {
                context.Material.Add(m);
            }
            context.SaveChanges();

            /*
             * var shippingTime = new ShippingTime[]{
             *
             *  new ShippingTime
             *  {
             *      Days = 3
             *  },
             *  new ShippingTime
             *  {
             *      Days = 5
             *  },
             *  new ShippingTime
             *  {
             *      Days = 7
             *  },
             *  new ShippingTime
             *  {
             *      Days = 14
             *  }
             * };
             *
             * foreach (ShippingTime st in shippingTime)
             * {
             *  context.ShippingTime.Add(st);
             * }
             * context.SaveChanges();
             */
        }
Ejemplo n.º 3
0
 public IndexModel(MegaDeskWeb.Data.MegaDeskContext context)
 {
     _context = context;
 }
Ejemplo n.º 4
0
 public DetailsModel(MegaDeskWeb.Data.MegaDeskContext context)
 {
     _context = context;
 }
Ejemplo n.º 5
0
 public DeleteModel(MegaDeskWeb.Data.MegaDeskContext context)
 {
     _context = context;
 }