Example #1
0
        public IActionResult Index()
        {
            HomeRestaurantViewModel objviewModel = new HomeRestaurantViewModel()
            {
                resturants = _restaurantData.GetAll(),
                greeting   = _greeting.getGreetings()
            };

            return(View(objviewModel));
        }
Example #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, IGreeting config, ILogger <Startup> logger)
        {
            var greeting = config.getGreetings();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler();
            }
            //app.Use(next =>
            //{
            //    return async context => {
            //       await context.Response.WriteAsync("HIT!!");
            //    };

            //    //return async context =>
            //    //{
            //    //    logger.LogInformation("Request Started");
            //    //    if(context.Request.Path.StartsWithSegments("/mym"))
            //    //    {
            //    //        await context.Response.WriteAsync("HIT!!");
            //    //        logger.LogInformation("Request handled..");
            //    //    }
            //    //    else
            //    //    {
            //    //        await next(context);
            //    //        logger.LogInformation("Request outgoing..");
            //    //    }
            //    //};
            //});
            //app.UseDefaultFiles();
            //app.UseStaticFiles();
            app.UseMvc(configureRoutes);
            //app.UseWelcomePage(new WelcomePageOptions {
            //    Path = "/wp"
            //});

            app.Run(async(context) =>
            {
                //throw new Exception();
                await context.Response.WriteAsync($"{greeting} and {env.EnvironmentName} ");
            });
        }