Пример #1
0
        public CreateModel(MegaDesk30.Models.MegaDesk30Context context)
        {
            _context = context;
            IQueryable <string> matQuery = from m in _context.Material_1
                                           orderby m.MaterialType
                                           select m.MaterialType;

            Materials = new SelectList(matQuery.Distinct().ToList());
        }
Пример #2
0
 public DeleteModel(MegaDesk30.Models.MegaDesk30Context context)
 {
     _context = context;
 }
Пример #3
0
 public EditModel(MegaDesk30.Models.MegaDesk30Context context)
 {
     _context = context;
 }
Пример #4
0
 public IndexModel(MegaDesk30.Models.MegaDesk30Context context)
 {
     _context = context;
 }
Пример #5
0
 public DetailsModel(MegaDesk30.Models.MegaDesk30Context context)
 {
     _context = context;
 }
Пример #6
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new MegaDesk30Context(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <MegaDesk30Context> >()))
            {
                // Look for any movies.
                if (context.Material_1.Any())
                {
                    return;   // DB has been seeded
                }


                context.Material_1.AddRange(
                    new MegaDesk30.Models.Material
                {
                    MaterialType = "Oak",
                    Price        = 200
                },
                    new MegaDesk30.Models.Material
                {
                    MaterialType = "Laminate",
                    Price        = 100
                },
                    new MegaDesk30.Models.Material
                {
                    MaterialType = "Pine",
                    Price        = 50
                },
                    new MegaDesk30.Models.Material
                {
                    MaterialType = "Veneer",
                    Price        = 125
                },
                    new MegaDesk30.Models.Material
                {
                    MaterialType = "Oak",
                    Price        = 200
                }
                    );

                context.Delivery.AddRange(
                    new MegaDesk30.Models.Delivery
                {
                    RushOrderDay = "3 Day"
                },
                    new MegaDesk30.Models.Delivery
                {
                    RushOrderDay = "5 Day"
                },
                    new MegaDesk30.Models.Delivery
                {
                    RushOrderDay = "7 Day"
                },
                    new MegaDesk30.Models.Delivery
                {
                    RushOrderDay = "14 Day"
                }
                    );

                context.SaveChanges();
            }
        }