refact
This commit is contained in:
parent
5de53a3cba
commit
476d35ae8a
270 changed files with 477 additions and 401 deletions
68
src/isnd/Controllers/HomeController.cs
Normal file
68
src/isnd/Controllers/HomeController.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using isn.Entities;
|
||||
using isn.Data;
|
||||
using System.Linq;
|
||||
using isn.ViewModels;
|
||||
using Unleash.ClientFactory;
|
||||
using Unleash;
|
||||
|
||||
namespace isn.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
readonly IHostingEnvironment _environment;
|
||||
public SmtpSettings _smtpSettings { get; } //set only via Secret Manager
|
||||
|
||||
private ApplicationDbContext _dbContext;
|
||||
|
||||
public HomeController(
|
||||
IOptions<SmtpSettings> smtpSettings,
|
||||
IHostingEnvironment environment,
|
||||
ApplicationDbContext dbContext,
|
||||
ILogger<HomeController> logger)
|
||||
{
|
||||
_environment = environment;
|
||||
_logger = logger;
|
||||
_smtpSettings = smtpSettings.Value;
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View(new HomeIndexViewModel{
|
||||
PkgCount = _dbContext.Packages.Count(),
|
||||
UnleashClient = Startup.UnleashĈlient
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult About()
|
||||
{
|
||||
ViewData["Message"] = "Your application description page.";
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Contact()
|
||||
{
|
||||
ViewData["Message"] = "Your contact page.";
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
ViewData["Message"] = "Your Privacy page.";
|
||||
|
||||
return View(ViewData);
|
||||
}
|
||||
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue