internal static void Initialize(BoatChartersDbContext db) { db.Database.Migrate(); if (db.Products.Count() == 0) { db.Products.Add(new Yacht { Name = "Helia 450", Description = "bla bla", Image = "/images/cat1.jpg", Size = 45, PriceHighSeason = 11000m, PriceOffSeason = 5000m, Year = 2015, AirCond = false, Cabins = 4 }); db.Products.Add(new Yacht { Name = "Helia 400", Description = "bla bla bla", Image = "/images/cat2.jpg", Size = 40, PriceHighSeason = 9000m, PriceOffSeason = 4000m, Year = 2015, AirCond = false, Cabins = 3 }); db.SaveChanges(); } }
public CheckOutController(BoatChartersDbContext oContext, EmailService emailService, SignInManager <BoatChartesUser> signInManager, Braintree.BraintreeGateway braintreeGateway, SmartyStreets.USStreetApi.Client usStreetApiClient) { _oContext = oContext; _emailService = emailService; _signInManager = signInManager; _braintreeGateway = braintreeGateway; _usStreetApiClient = usStreetApiClient; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, BoatChartersDbContext 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 SignIn/SignOut status app.UseAuthentication(); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); DbInitializer.Initialize(db); }); }
public CartController(BoatChartersDbContext context) { _context = context; }
public YachtsAdminController(BoatChartersDbContext context, IHostingEnvironment env) { _context = context; _env = env; }
public HomeController(BoatChartersDbContext boatChartersDbContext) { _db = boatChartersDbContext; }