generated from egmont11/ASP.Net-Core-MVC-Template
32 lines
835 B
C#
32 lines
835 B
C#
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 });
|
|
}
|
|
} |