Home index

This commit is contained in:
2024-11-02 15:33:46 +00:00
parent 72ecf30458
commit 753f54dad0
4 changed files with 19 additions and 6 deletions

View File

@ -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()