generated from egmont11/ASP.Net-Core-MVC-Template
Přemístění + dodělání funkčnosti webu.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using StuzkovakWeb.Data;
|
||||
using StuzkovakWeb.Models;
|
||||
|
||||
namespace StuzkovakWeb.Controllers;
|
||||
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
|
||||
public HomeController(AppDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public IActionResult Index(Guid? id)
|
||||
{
|
||||
if (id == null) return View();
|
||||
|
||||
var invite = _context.Invites.FirstOrDefault(i => i.Id == id);
|
||||
if (invite == null) return NotFound();
|
||||
|
||||
return View(invite);
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user