コード例 #1
0
ファイル: HomeController.cs プロジェクト: nickandrea/Training
        public IActionResult Index()
        {
            var model = new HomeIndexViewModel();

            model.Restaurants    = restaurantDataSource.getAll();
            model.CurrentMessage = greeting.getGreting();
            return(View(model));
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: nickandrea/Training
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGreeting greeting, ILogger <Startuppa> logger, IConfiguration conf)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            /*app.Use(next =>
             * {
             * logger.LogInformation("Use Called");
             *  return async context =>
             *  {
             *      logger.LogInformation("Request incoming" + DateTime.Now);
             *      if (context.Request.Path.StartsWithSegments("/mym"))
             *      {
             *          await context.Response.WriteAsync("Hit!!");
             *          logger.LogInformation("Request Handled");
             *      }
             *      else
             *      {
             *          await next(context);
             *          logger.LogInformation("Response Incoming");
             *      }
             *  };
             * });
             */

            app.UseMvc(configureRoutes);

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

            app.Run(async(context) =>
            {
                String message = greeting.getGreting();
                message        = conf["Greeting"];
                await context.Response.WriteAsync($"Not Found");
            });
        }