// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, BurgerStoreDbContext db) { if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } //I need this to instruct my app to use cookies for tracking sign in/out status app.UseAuthentication(); app.UseStaticFiles(); //seeding database DbInitializer.Initialize(db); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
public CheckoutController(BurgerStoreDbContext burgerstoredbcontext, EmailService emailService, SignInManager <BurgerStoreUser> signInManager, BraintreeGateway braintreeGateway, SmartyStreets.USStreetApi.Client usStreetApiClient) { this._burgerStoreDbContext = burgerstoredbcontext; this._emailService = emailService; this._signInManager = signInManager; this._braintreeGateway = braintreeGateway; this._usStreetApiClient = usStreetApiClient; }
internal static void Initialize(this BurgerStoreDbContext db) { //Sometimes this has to be commented out if you run into migrations/db rebuild issues db.Database.Migrate(); if (db.Products.Count() == 0) { db.Products.Add(new Product { Name = "Ground Beef Burger", Description = "Our special 80/20 blend of ground beef", Image = "/images/burger1.jpeg ", Price = 5.99m, Organic = false, Grassfed = false }); db.Products.Add(new Product { Name = "Organic Grassfed Ground Beef Burger", Description = "A delicious blend of humanely raised ground organic grassfed beef", Image = "/images/burger2.jpeg ", Price = 7.99m, Organic = true, Grassfed = true }); db.Products.Add(new Product { Name = "Ground Turkey Burger", Description = "Thanksgiving on the grill!", Image = "/images/burger3.jpeg ", Price = 3.99m, Organic = false, Grassfed = false }); db.Products.Add(new Product { Name = "Veggie Burger", Description = "A healthy and delicous meat alternative for your grilling pleasure!", Image = "/images/veggieburger.jpeg", Price = 5.99M, Organic = true, Grassfed = false }); //This helps not make the request too "chatty" with SQL(locking tables) db.SaveChanges(); } }
public CartController(BurgerStoreDbContext burgerstoredbcontext) { _burgerStoreDbContext = burgerstoredbcontext; }
public ProductsAdminController(BurgerStoreDbContext context, IHostingEnvironment env) { _context = context; _env = env; }
//private List<Product> _products; public ProductController(BurgerStoreDbContext burgerStoreDbContext) //injection { _burgerStoreDbContext = burgerStoreDbContext; }