Пример #1
0
 public TervehdysViewComponent(ITervehtija tervehdys)
 {
     _tervehdys = tervehdys;
 }
Пример #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, ILoggerFactory loggerFactory, ITervehtija tervehtija)
        {
            loggerFactory.AddConsole();
            //app.UseDefaultFiles();
            //app.UseStaticFiles();
            app.UseFileServer();
            app.UseNodeModules(env.ContentRootPath);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                loggerFactory.AddDebug(LogLevel.Information);
            }
            else
            {
                app.UseExceptionHandler(new ExceptionHandlerOptions
                {
                    ExceptionHandlingPath = "/virhe"
                                            //ExceptionHandler = context => context.Response.WriteAsync("Hupsista!")
                });
                loggerFactory.AddDebug(LogLevel.Error);
            }

            //app.UseWelcomePage(new WelcomePageOptions { Path = "/welcome" });

            app.UseIdentity();
            app.UseMvc(ConfigureRoutes);

            //app.Run(context => context.Response.WriteAsync("Sivua ei löytynyt."));
        }
Пример #3
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, ITervehtija tervehtija)
        {
            loggerFactory.AddConsole();

            //app.UseDefaultFiles(); // Käyttää index.html tiedostoa defaulttina
            //app.UseStaticFiles(); // Käyttää wwwroot kansion tiedostoja
            app.UseFileServer(); // Korvaa edelliset
            app.UseNodeModules(env.ContentRootPath);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                loggerFactory.AddDebug(LogLevel.Information);
            }
            else
            {
                app.UseExceptionHandler(new ExceptionHandlerOptions {
                    ExceptionHandlingPath = "/virhe"
                                            //ExceptionHandler = context => context.Response.WriteAsync("Hupsista!")
                });
                loggerFactory.AddDebug(LogLevel.Error);
            }

            app.UseIdentity();

            app.UseMvc(ConfigureRoutes);

            //app.Run(context =>
            //{
            //    context.Response.ContentType = "text/html; charset=utf-8";
            //    return context.Response.WriteAsync("Sivua ei löytynyt.");
            //});

            //app.UseWelcomePage(new WelcomePageOptions { Path = "/welcome" });

            //app.Run(async (context) =>
            //{
            //    var message = tervehtija.GetTervehdys();
            //    //var message = Configuration["Tervehdys"];
            //    await context.Response.WriteAsync(message);
            //    //await context.Response.WriteAsync("Hello World!!!");
            //});
        }
Пример #4
0
 public EtusivuController(IRavintolaRepository ravintolaData, ITervehtija tervehtija)
 {
     _tervehtija    = tervehtija;
     _ravintolaData = ravintolaData;
 }