Exemplo n.º 1
0
 public ShippingController(JoshTestContext context, Braintree.BraintreeGateway braintreeGateway, SignInManager <ApplicationUser> signInManager, SmartyStreets.USStreetApi.Client usStreetClient)
 {
     _context          = context;
     _braintreeGateway = braintreeGateway;
     _signInManager    = signInManager;
     _usStreetClient   = usStreetClient;
 }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, JoshTestContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseBrowserLink(); //I added this manually
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseDeveloperExceptionPage();
            app.UseAuthentication();
            app.UseMvc();
            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            DbInitializer.Initialize(context);
        }
Exemplo n.º 3
0
 public ProductsController(JoshTestContext context)
 {
     _context = context;
 }
Exemplo n.º 4
0
        internal static void Initialize(JoshTestContext context)
        {
            //Making sure database exists
            context.Database.Migrate();

            if (!context.Genres.Any())
            {
                context.Genres.Add(new Genres
                {
                    Name             = "Jazz",
                    ImageUrl         = "/images/jazzgenre.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now
                });
                context.Genres.Add(new Genres
                {
                    Name             = "Rock",
                    ImageUrl         = "/images/rockgenre.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now
                });
                context.Genres.Add(new Genres
                {
                    Name             = "Hip Hop",
                    ImageUrl         = "/images/hiphopgenre.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now
                });
                context.Genres.Add(new Genres
                {
                    Name             = "Electronic",
                    ImageUrl         = "/images/electronicgenre.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now
                });
                context.Genres.Add(new Genres
                {
                    Name             = "FX",
                    ImageUrl         = "/images/FXgenre.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now
                });
                context.Genres.Add(new Genres
                {
                    Name             = "Vocal Samples",
                    ImageUrl         = "/images/vocalgenre.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now
                });
                context.Genres.Add(new Genres
                {
                    Name             = "Classical",
                    ImageUrl         = "/images/classicalgenre.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now
                });
                context.Genres.Add(new Genres
                {
                    Name             = "Pop",
                    ImageUrl         = "/images/funkdiscogenre.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now
                });
            }
            context.SaveChanges();

            if (!context.Products.Any())
            {
                context.Products.Add(new Products
                {
                    Name             = "Jazz Strings",
                    Price            = 49.99m,
                    Description      = "A collection of silky smooth Jazz samples.",
                    ImageUrl         = "/images/jazz.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now,
                    //TODO: Add to a Genre category
                    Genre = context.Genres.First(x => x.Name == "Jazz")
                });
                context.Products.Add(new Products
                {
                    Name             = "Jazz Drums",
                    Price            = 29.99m,
                    Description      = "Recreate the sharp, tangy sounds of classic Jazz drumkits.",
                    ImageUrl         = "/images/jazzdrums.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now,
                    Genre            = context.Genres.First(x => x.Name == "Jazz")
                });
                context.Products.Add(new Products
                {
                    Name             = "Jazz Horns",
                    Price            = 24.99m,
                    Description      = "Everything from smooth sax to lively trumpet.",
                    ImageUrl         = "/images/jazzgenre.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now,
                    Genre            = context.Genres.First(x => x.Name == "Jazz")
                });
                context.Products.Add(new Products
                {
                    Name             = "Rock Drums",
                    Price            = 19.99m,
                    Description      = "Recreate the rugged drumkits of Rock music.",
                    ImageUrl         = "/images/rock.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now,
                    Genre            = context.Genres.First(x => x.Name == "Rock")
                });
                context.Products.Add(new Products
                {
                    Name             = "Boom Bap Pack",
                    Price            = 14.99m,
                    Description      = "Bring back the sounds of the Golden Age of Hip Hop.",
                    ImageUrl         = "/images/hiphop.jpg",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now,
                    Genre            = context.Genres.First(x => x.Name == "Hip Hop")
                });
                context.Products.Add(new Products
                {
                    Name             = "808 Drums",
                    Price            = 14.99m,
                    Description      = "Full array of professional drum sounds for New Age Hip Hop",
                    ImageUrl         = "/images/808.png",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now,
                    Genre            = context.Genres.First(x => x.Name == "Hip Hop")
                });
            }
            context.SaveChanges();
            if (!context.Reviews.Any())
            {
                context.Reviews.Add(new Review
                {
                    Rating     = 5,
                    Body       = "Totally worth the money!",
                    IsApproved = true,
                    Product    = context.Products.First(), //adds review to 1st product in database
                });
            }
            context.SaveChanges();
        }
Exemplo n.º 5
0
 public OrderController(JoshTestContext context)
 {
     _context = context;
 }
Exemplo n.º 6
0
 public GenresController(JoshTestContext context)
 {
     _context = context;
 }