diff --git a/src/isnd/Controllers/HomeController.cs b/src/isnd/Controllers/HomeController.cs index 6c3836b..b811535 100644 --- a/src/isnd/Controllers/HomeController.cs +++ b/src/isnd/Controllers/HomeController.cs @@ -6,6 +6,10 @@ using System.Linq; using isnd.ViewModels; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.Build.Logging; +using Microsoft.Extensions.Options; +using isnd.Entities; +using isn.abst; namespace isnd.Controllers { @@ -15,14 +19,18 @@ namespace isnd.Controllers public class HomeController : Controller { private readonly ApplicationDbContext _dbContext; + private readonly IsndSettings _isndSettings; + /// /// Home controller ctor /// /// + /// public HomeController( - ApplicationDbContext dbContext) + ApplicationDbContext dbContext, IOptions isndSettings) { _dbContext = dbContext; + _isndSettings = isndSettings.Value; } public IActionResult Index() @@ -30,7 +38,8 @@ namespace isnd.Controllers return View(new HomeIndexViewModel{ PkgCount = _dbContext.Packages .Where(p => p.Versions.Count > 0) - .Count()}); + .Count(), + APIUrl = _isndSettings.ExternalUrl + Constants.ApiVersionPrefix + ApiConfig.Index}); } public IActionResult About() diff --git a/src/isnd/Controllers/Packages/ApiIndex.cs b/src/isnd/Controllers/Packages/ApiIndex.cs index bb88187..44ca507 100644 --- a/src/isnd/Controllers/Packages/ApiIndex.cs +++ b/src/isnd/Controllers/Packages/ApiIndex.cs @@ -33,7 +33,7 @@ namespace isnd.Controllers [HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Index)] public IActionResult ApiIndex() { - return Ok(new ApiIndexViewModel(packageManager.CatalogBaseUrl + "/index.json"){ Version = PackageManager.BASE_API_LEVEL, Resources = resources }); + return Ok(new ApiIndexViewModel(packageManager.CatalogBaseUrl + ApiConfig.Index){ Version = PackageManager.BASE_API_LEVEL, Resources = resources }); } } diff --git a/src/isnd/ViewModels/HomeIndexViewModel.cs b/src/isnd/ViewModels/HomeIndexViewModel.cs index d4dead9..cebb907 100644 --- a/src/isnd/ViewModels/HomeIndexViewModel.cs +++ b/src/isnd/ViewModels/HomeIndexViewModel.cs @@ -5,5 +5,7 @@ namespace isnd.ViewModels { public int PkgCount { get; set; } + public string APIUrl { get; set; } + } } \ No newline at end of file diff --git a/src/isnd/Views/Home/Index.cshtml b/src/isnd/Views/Home/Index.cshtml index 8d710a7..748ae06 100644 --- a/src/isnd/Views/Home/Index.cshtml +++ b/src/isnd/Views/Home/Index.cshtml @@ -1,8 +1,10 @@ @model HomeIndexViewModel @{ - ViewData["Title"] = "Home Page"; + ViewData["Title"] = "Packages"; } - Bom -'Key! + @ViewData["Title"] + +Nuget API v3 : + @Model.APIUrl \ No newline at end of file
'Key!
Nuget API v3 : + @Model.APIUrl
@Model.APIUrl