86 lines
2 KiB
C#
86 lines
2 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using isnd.Data;
|
|
using System.Linq;
|
|
using isnd.ViewModels;
|
|
using System.Reflection;
|
|
using Isn.Abstract;
|
|
|
|
namespace isnd.Controllers
|
|
{
|
|
/// <summary>
|
|
/// Home Controller
|
|
/// </summary>
|
|
public class HomeController : Controller
|
|
{
|
|
private readonly ApplicationDbContext _dbContext;
|
|
/// <summary>
|
|
/// Home controller ctor
|
|
/// </summary>
|
|
/// <param name="dbContext"></param>
|
|
|
|
public HomeController(
|
|
ApplicationDbContext dbContext)
|
|
{
|
|
_dbContext = dbContext;
|
|
}
|
|
|
|
/**
|
|
* Index
|
|
*/
|
|
public IActionResult Index()
|
|
{
|
|
return View(new HomeIndexViewModel
|
|
{
|
|
PkgCount = _dbContext.Packages
|
|
.Where(p => p.Versions.Count > 0)
|
|
.Count()
|
|
});
|
|
}
|
|
|
|
/**
|
|
* About
|
|
*/
|
|
public IActionResult About()
|
|
{
|
|
ViewData["Message"] = "Your application description page.";
|
|
|
|
return View();
|
|
}
|
|
|
|
/**
|
|
* Contact
|
|
*/
|
|
public IActionResult Contact()
|
|
{
|
|
ViewData["Message"] = "Your contact page.";
|
|
var ass = typeof(Resource).GetType().Assembly;
|
|
var attrs = ass.GetCustomAttributes(true);
|
|
// ass.GetCustomAttributes(true);
|
|
System.Reflection.AssemblyFileVersionAttribute v = (AssemblyFileVersionAttribute)
|
|
GetType().Assembly.GetCustomAttribute(typeof(AssemblyFileVersionAttribute));
|
|
|
|
return View();
|
|
}
|
|
|
|
/**
|
|
* Privacy
|
|
*/
|
|
public IActionResult Privacy()
|
|
{
|
|
ViewData["Message"] = "Your Privacy page.";
|
|
|
|
return View(ViewData);
|
|
}
|
|
|
|
/**
|
|
* Error
|
|
*/
|
|
public IActionResult Error()
|
|
{
|
|
return View();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|