55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
using ChangeloggerMVC.Models;
|
|
using ChangeloggerMVC.Models;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ChangeloggerMVC.Controllers
|
|
{
|
|
public class HomeController : Controller
|
|
{
|
|
private readonly ILogger<HomeController> _logger;
|
|
private readonly IDatabase _database;
|
|
|
|
public HomeController(ILogger<HomeController> logger, IDatabase database)
|
|
{
|
|
_logger = logger;
|
|
_database = database;
|
|
}
|
|
|
|
public IActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
[HttpGet]
|
|
public IActionResult CreateEntry()
|
|
{
|
|
var oTypes = _database.GetTypes();
|
|
var oModules = _database.GetModules();
|
|
|
|
ViewData["Modules"] = oModules;
|
|
ViewData["Types"] = oTypes;
|
|
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
public IActionResult CreateEntry(ChangelogEntryModel EntryModel)
|
|
{
|
|
return RedirectToAction("Index", "Home");
|
|
}
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
public IActionResult Error()
|
|
{
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
|
}
|
|
}
|
|
}
|