Esempio n. 1
0
 public PartialRepository(WebTheCaoDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Esempio n. 2
0
 public ContactRepository(WebTheCaoDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Esempio n. 3
0
 public GiaoDichRepository(WebTheCaoDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Esempio n. 4
0
 public TagsRepository(WebTheCaoDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Esempio n. 5
0
 public MenhGiaRepository(WebTheCaoDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Esempio n. 6
0
 public FeedbackRepository(WebTheCaoDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Esempio n. 7
0
 public SlideRepository(WebTheCaoDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Esempio n. 8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            //app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseAuthentication();
            app.UseSession();
            app.UseResponseCompression();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "homeAdmin",
                    template: "{area:exists}/{controller=home}/{action=Index}/{id?}"
                    ); routes.MapRoute(
                    name: "cardAdmin",
                    template: "{area:exists}/{controller=card}/{action=Index}/{id?}"
                    ); routes.MapRoute(
                    name: "NopCardAdmin",
                    template: "{area:exists}/{controller=giao-dich}/{action=Index}/{id?}"
                    ); routes.MapRoute(
                    name: "slideAdmin",
                    template: "{area:exists}/{controller=slide}/{action=Index}/{id?}"
                    ); routes.MapRoute(
                    name: "feedbackAdmin",
                    template: "{area:exists}/{controller=feedback}/{action=Index}/{id?}"
                    ); routes.MapRoute(
                    name: "pageAdmin",
                    template: "{area:exists}/{controller=page}/{action=Index}/{id?}"
                    ); routes.MapRoute(
                    name: "postAdmin",
                    template: "{area:exists}/{controller=post}/{action=Index}/{id?}"
                    ); routes.MapRoute(
                    name: "tagsAdmin",
                    template: "{area:exists}/{controller=tags}/{action=Index}/{id?}"
                    ); routes.MapRoute(
                    name: "contactAdmin",
                    template: "{area:exists}/{controller=contact}/{action=Index}/{id?}"
                    ); routes.MapRoute(
                    name: "accountAdmin",
                    template: "{area:exists}/{controller=account}/{action=Index}/{id?}"
                    );
                routes.MapRoute(
                    name: "nopthe",
                    template: "/nap-the.html",
                    defaults: new { controller = "Card", action = "Index" }
                    ); routes.MapRoute(
                    name: "post",
                    template: "/khuyen-mai.html",
                    defaults: new { controller = "Post", action = "Index" }
                    ); routes.MapRoute(
                    name: "post-detail",
                    template: "/khuyen-mai/{metaname}/{id}",
                    defaults: new { controller = "Post", action = "Detail" }
                    ); routes.MapRoute(
                    name: "lien-he",
                    template: "/lien-he.html",
                    defaults: new { controller = "Page", action = "ContactPage" }
                    ); routes.MapRoute(
                    name: "bang-gia",
                    template: "/bang-gia.html",
                    defaults: new { controller = "Page", action = "BangGia" }
                    ); routes.MapRoute(
                    name: "NopCard",
                    template: "/giao-dich/{userId}",
                    defaults: new { controller = "UserAccount", action = "LichSuNopCard" }
                    ); routes.MapRoute(
                    name: "NapThe",
                    template: "/giao-dich/nap-tien",
                    defaults: new { controller = "UserAccount", action = "NapTien" }
                    ); routes.MapRoute(
                    name: "XacThuc",
                    template: "UserAccount/ConfirmEmail/{userid?}/{token?}",
                    defaults: new { controller = "UserAccount", action = "ConfirmEmail" }
                    );
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Card}/{action=Index}/{id?}");
            });
            WebTheCaoDbContext.CreateAdminAccount(app.ApplicationServices, Configuration).Wait();
            using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                var dbContext   = serviceScope.ServiceProvider.GetRequiredService <WebTheCaoDbContext>();
                var roleManager = serviceScope.ServiceProvider.GetService <RoleManager <IdentityRole> >();
                var userManager = serviceScope.ServiceProvider.GetService <UserManager <ApplicationUser> >();
                dbContext.Database.Migrate();
                DbSeeder.Seed(dbContext, roleManager, userManager);
            }
        }
Esempio n. 9
0
 public NopCardRepository(WebTheCaoDbContext dbContext)
 {
     _dbContext = dbContext;
 }