using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Kochstube.Models; using Kochstube.Services; namespace Kochstube.Pages; public class IndexModel : PageModel { private readonly RezeptService _service; public IndexModel(RezeptService service) => _service = service; public List Rezepte { get; set; } = []; public List AlleTags { get; set; } = []; public List AlleKategorien { get; set; } = []; [BindProperty(SupportsGet = true)] public string? Q { get; set; } [BindProperty(SupportsGet = true)] public string? Tag { get; set; } [BindProperty(SupportsGet = true)] public string? Kategorie { get; set; } public void OnGet() { AlleTags = _service.GetAllTags(); AlleKategorien = _service.GetAllKategorien(); Rezepte = _service.Search(Q, Tag, Kategorie); ViewData["Title"] = "Rezepte"; } }