|
1 | | -using System; |
2 | | -using System.Collections.Generic; |
3 | | -using System.Diagnostics; |
4 | | -using System.Linq; |
5 | | -using System.Threading.Tasks; |
6 | | -using Microsoft.AspNetCore.Mvc; |
| 1 | +using Microsoft.AspNetCore.Mvc; |
7 | 2 | using Microsoft.Extensions.Configuration; |
8 | | -using Microsoft.Extensions.Options; |
| 3 | +using Microsoft.Extensions.Logging; |
| 4 | +using System.Diagnostics; |
9 | 5 | using TripViewer.Models; |
10 | 6 | using TripViewer.Utility; |
11 | 7 |
|
12 | 8 | namespace TripViewer.Controllers |
13 | 9 | { |
14 | 10 | public class HomeController : Controller |
15 | 11 | { |
| 12 | + private readonly ILogger<HomeController> _logger; |
16 | 13 | private readonly IConfiguration Configuration; |
17 | 14 |
|
18 | | - public HomeController(IConfiguration configuration) |
| 15 | + public HomeController(ILogger<HomeController> logger, IConfiguration configuration) |
19 | 16 | { |
| 17 | + _logger = logger; |
20 | 18 | Configuration = configuration; |
21 | 19 | } |
| 20 | + |
22 | 21 | public IActionResult Index() |
23 | 22 | { |
24 | | - TripViewerConfiguration tv = new TripViewerConfiguration(); |
25 | | - |
26 | | - tv.USER_ROOT_URL = Configuration.GetValue<string>("USER_ROOT_URL"); |
27 | | - tv.USER_JAVA_ROOT_URL = Configuration.GetValue<string>("USER_JAVA_ROOT_URL"); |
28 | | - tv.TRIPS_ROOT_URL = Configuration.GetValue<string>("TRIPS_ROOT_URL"); |
29 | | - tv.POI_ROOT_URL = Configuration.GetValue<string>("POI_ROOT_URL"); |
| 23 | + TripViewerConfiguration tv = new TripViewerConfiguration |
| 24 | + { |
| 25 | + USER_ROOT_URL = Configuration.GetValue<string>("USER_ROOT_URL"), |
| 26 | + USER_JAVA_ROOT_URL = Configuration.GetValue<string>("USER_JAVA_ROOT_URL"), |
| 27 | + TRIPS_ROOT_URL = Configuration.GetValue<string>("TRIPS_ROOT_URL"), |
| 28 | + POI_ROOT_URL = Configuration.GetValue<string>("POI_ROOT_URL") |
| 29 | + }; |
30 | 30 | return View(tv); |
31 | 31 | } |
32 | 32 |
|
33 | | - public IActionResult About() |
34 | | - { |
35 | | - ViewData["Message"] = "Your application description page."; |
36 | | - |
37 | | - return View(); |
38 | | - } |
39 | | - |
40 | | - public IActionResult Contact() |
41 | | - { |
42 | | - ViewData["Message"] = "Your contact page."; |
43 | | - |
44 | | - return View(); |
45 | | - } |
46 | | - |
47 | 33 | public IActionResult Privacy() |
48 | 34 | { |
49 | 35 | return View(); |
|
0 commit comments