isn/src/isnd/Controllers/HomeController.cs

86 lines
2 KiB
C#
Raw Normal View History

2026-07-05 17:22:57 +01:00
using Microsoft.AspNetCore.Mvc;
2021-08-15 19:09:01 +01:00
using isnd.Data;
2021-06-22 00:10:01 +01:00
using System.Linq;
2021-08-15 19:09:01 +01:00
using isnd.ViewModels;
2022-04-17 20:36:28 +01:00
using System.Reflection;
2026-07-05 17:22:57 +01:00
using Isn.Abstract;
2021-04-08 02:03:17 +01:00
2021-08-15 19:09:01 +01:00
namespace isnd.Controllers
2021-04-08 02:03:17 +01:00
{
2023-01-29 13:04:50 +00:00
/// <summary>
/// Home Controller
/// </summary>
2021-04-08 02:03:17 +01:00
public class HomeController : Controller
{
2021-07-11 18:08:49 +01:00
private readonly ApplicationDbContext _dbContext;
2023-01-29 13:04:50 +00:00
/// <summary>
/// Home controller ctor
/// </summary>
/// <param name="dbContext"></param>
2021-06-22 00:10:01 +01:00
2021-04-25 12:12:50 +01:00
public HomeController(
2026-07-05 17:54:36 +01:00
ApplicationDbContext dbContext)
2021-04-11 22:39:26 +01:00
{
2021-06-22 00:10:01 +01:00
_dbContext = dbContext;
2021-04-11 22:39:26 +01:00
}
2026-07-05 17:22:57 +01:00
/**
* Index
*/
2021-04-08 02:03:17 +01:00
public IActionResult Index()
{
2026-07-05 17:22:57 +01:00
return View(new HomeIndexViewModel
{
2022-07-03 14:50:57 +01:00
PkgCount = _dbContext.Packages
.Where(p => p.Versions.Count > 0)
2026-07-05 17:54:36 +01:00
.Count()
2026-07-05 17:22:57 +01:00
});
2021-04-08 02:03:17 +01:00
}
2026-07-05 17:22:57 +01:00
/**
* About
*/
2021-04-08 02:03:17 +01:00
public IActionResult About()
{
ViewData["Message"] = "Your application description page.";
return View();
}
2026-07-05 17:22:57 +01:00
/**
* Contact
*/
2021-04-08 02:03:17 +01:00
public IActionResult Contact()
{
ViewData["Message"] = "Your contact page.";
2026-07-05 17:22:57 +01:00
var ass = typeof(Resource).GetType().Assembly;
2022-04-17 20:36:28 +01:00
var attrs = ass.GetCustomAttributes(true);
// ass.GetCustomAttributes(true);
2026-07-05 17:22:57 +01:00
System.Reflection.AssemblyFileVersionAttribute v = (AssemblyFileVersionAttribute)
2022-04-17 20:36:28 +01:00
GetType().Assembly.GetCustomAttribute(typeof(AssemblyFileVersionAttribute));
2021-04-08 02:03:17 +01:00
return View();
}
2026-07-05 17:22:57 +01:00
/**
* Privacy
*/
2021-04-25 12:12:50 +01:00
public IActionResult Privacy()
2021-04-08 02:03:17 +01:00
{
2021-04-25 12:12:50 +01:00
ViewData["Message"] = "Your Privacy page.";
2021-04-08 02:03:17 +01:00
2021-06-21 23:38:05 +01:00
return View(ViewData);
2021-04-08 02:03:17 +01:00
}
2026-07-05 17:22:57 +01:00
/**
* Error
*/
2021-05-23 01:00:57 +01:00
public IActionResult Error()
{
return View();
}
2021-04-08 02:03:17 +01:00
}
}
2022-04-17 20:36:28 +01:00