public CheckoutController(DonutStoreDbContext donutStoreDbContext, EmailService emailService, SignInManager <DonutStoreUser> signInManager, BraintreeGateway braintreeGateway) { _donutStoreDbContext = donutStoreDbContext; _emailService = emailService; _signInManager = signInManager; _brainTreeGateway = braintreeGateway; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, DonutStoreDbContext db) { if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } //this instructs app to use cookies for sign in/out app.UseStaticFiles(); app.UseAuthentication(); //seeding database DbInitializer.Initialize(db); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
internal static void Initialize(this DonutStoreDbContext db) { db.Database.Migrate(); if (db.Products.Count() == 0) { db.Products.Add(new Product { Name = "Sprinkles Donut", Description = "Homer Simpson Style Donut", Image = "/images/donut1.jpeg", Price = 1.99m }); db.Products.Add(new Product { Name = "Mix and Match", Description = "Various Donuts", Image = "/images/donut3.jpeg", Price = 2.99m }); db.SaveChanges(); } }
public CartController(DonutStoreDbContext context) { _donutStoreDbContext = context; }
public ProductController(DonutStoreDbContext donutStoreDbContext) { _donutStoreDbContext = donutStoreDbContext; }
public ProductsAdminController(DonutStoreDbContext context, IHostingEnvironment env) { _context = context; _env = env; }