24 lines
557 B
C#
24 lines
557 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using Kochstube.Models;
|
|
using Kochstube.Services;
|
|
|
|
namespace Kochstube.Pages;
|
|
|
|
public class RezeptModel : PageModel
|
|
{
|
|
private readonly RezeptService _service;
|
|
|
|
public RezeptModel(RezeptService service) => _service = service;
|
|
|
|
public Rezept? Rezept { get; set; }
|
|
|
|
public IActionResult OnGet(string id)
|
|
{
|
|
Rezept = _service.GetById(id);
|
|
if (Rezept == null) return NotFound();
|
|
ViewData["Title"] = Rezept.Titel;
|
|
return Page();
|
|
}
|
|
}
|