Home index
This commit is contained in:
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Home controller ctor
|
||||
/// </summary>
|
||||
/// <param name="dbContext"></param>
|
||||
/// <param name="isndSettings"></param>
|
||||
public HomeController(
|
||||
ApplicationDbContext dbContext)
|
||||
ApplicationDbContext dbContext, IOptions<IsndSettings> 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()
|
||||
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,5 +5,7 @@ namespace isnd.ViewModels
|
||||
{
|
||||
public int PkgCount { get; set; }
|
||||
|
||||
public string APIUrl { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
@model HomeIndexViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
ViewData["Title"] = "Packages";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Bom</h1>
|
||||
<p>'Key!</p>
|
||||
<h1 class="display-4">@ViewData["Title"]</h1>
|
||||
<p></p>
|
||||
<p>Nuget API v3 :
|
||||
<a href="@Model.APIUrl"><code>@Model.APIUrl</code></a></p>
|
||||
</div>
|
Reference in New Issue
Block a user