示例#1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              ILoggerFactory loggerFactory, IDiscountChecker discountChecker)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler(new ExceptionHandlerOptions
                {
                    ExceptionHandler = context => context.Response.WriteAsync(
                        "<h1 style=\"text-align: center;\">Opps! Some unexpected error occured!</h1>")
                });
            }

            app.UseFileServer();

            app.UseNodeModules(env.ContentRootPath);

            app.UseIdentity();

            app.UseMvc(routProvider => routProvider.MapRoute("Default",
                                                             "{controller=home}/{action=index}/{id?}"));
        }
示例#2
0
 public HomeController(IPhonesData phonesData, IDiscountChecker discountChecker)
 {
     _phonesData      = phonesData;
     _discountChecker = discountChecker;
 }
示例#3
0
 public DiscountViewComponent(IDiscountChecker discountChecker)
 {
     _discountChecker = discountChecker;
 }