Last active
November 16, 2017 03:11
-
-
Save jglozano/6321ff153bdfdc3b13aeb3a98dd4c6bc to your computer and use it in GitHub Desktop.
.NET Development YTT Demo - HomeController code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.AspNetCore.Hosting; | |
using System.IO; | |
using Northwind.Data; | |
namespace Northwind.Web.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
private readonly IHostingEnvironment hostingEnvironment; | |
public HomeController(IHostingEnvironment env) | |
{ | |
hostingEnvironment = env; | |
} | |
public IActionResult Index() | |
{ | |
// Add to the service | |
var path = hostingEnvironment.ContentRootPath; | |
var folderPath = Path.Combine(path, "Database"); | |
var filePath = Path.Combine(folderPath, "northwind.xml"); | |
var data = NorthwindDb.GetData(filePath); | |
return View("index", data); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment