mirror of
				https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
				synced 2025-11-04 04:05:32 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
		
			967 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			967 B
		
	
	
	
		
			C#
		
	
	
	
	
	
using System.Linq;
 | 
						|
using Microsoft.AspNetCore.Mvc;
 | 
						|
using Microsoft.AspNetCore.Mvc.RazorPages;
 | 
						|
using HaDocument.Interfaces;
 | 
						|
using HaDocument.Models;
 | 
						|
using System;
 | 
						|
 | 
						|
 | 
						|
namespace HaLive.Pages
 | 
						|
{
 | 
						|
    public class BriefeModel : PageModel
 | 
						|
    {
 | 
						|
        internal ILibrary _lib;
 | 
						|
        
 | 
						|
        [BindProperty(SupportsGet = true)]
 | 
						|
        public string id { get; set; }
 | 
						|
 | 
						|
        public BriefeModel(ILibrary lib) {
 | 
						|
            _lib = lib;
 | 
						|
        }
 | 
						|
 | 
						|
        public IActionResult OnGet()
 | 
						|
        {
 | 
						|
            if (String.IsNullOrWhiteSpace(id)) {
 | 
						|
                return RedirectPermanent("/Briefe/1");
 | 
						|
            }
 | 
						|
            var res = _lib.Metas.Where(x => x.Value.Autopsic == id);
 | 
						|
            if (!res.Any() || !_lib.Metas.ContainsKey(res.First().Key))  {
 | 
						|
                Response.StatusCode = 404;
 | 
						|
                return RedirectToPage("/Error");
 | 
						|
            }
 | 
						|
            _lib.Metas.Where(x => x.Value.Autopsic == id).First();
 | 
						|
            return Page();
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |