From 935496603acbfc878a11edd879c32c17ac3b18c3 Mon Sep 17 00:00:00 2001 From: chsakell Date: Mon, 26 Sep 2016 09:53:59 +0300 Subject: [PATCH] add HomeController --- Controllers/HomeController.cs | 21 +++++++++++++++++++++ Startup.cs | 7 ++++++- Views/Home/Index.cshtml | 10 ++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Controllers/HomeController.cs create mode 100644 Views/Home/Index.cshtml diff --git a/Controllers/HomeController.cs b/Controllers/HomeController.cs new file mode 100644 index 0000000..20f7210 --- /dev/null +++ b/Controllers/HomeController.cs @@ -0,0 +1,21 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace ChatLe.Controllers +{ + public class HomeController : Controller + { + static ILogger _logger; + public HomeController(ILoggerFactory factory) + { + if (_logger == null) + _logger = factory.CreateLogger("Unhandled Error"); + } + + + public IActionResult Index() + { + return View(); + } + } +} \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index 902658b..c1cac8e 100644 --- a/Startup.cs +++ b/Startup.cs @@ -39,7 +39,12 @@ namespace LiveGameFeed loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); - app.UseMvc(); + app.UseMvc(routes => + { + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + }); app.UseSignalR(); } } diff --git a/Views/Home/Index.cshtml b/Views/Home/Index.cshtml new file mode 100644 index 0000000..d569ec2 --- /dev/null +++ b/Views/Home/Index.cshtml @@ -0,0 +1,10 @@ + + + + + + + +

Hello from home controller!

+ + \ No newline at end of file