mirror of
				https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
				synced 2025-10-31 02:05:33 +00:00 
			
		
		
		
	Initial replacement of old repository.
This commit is contained in:
		
							
								
								
									
										36
									
								
								HaLive/Pages/Briefe.cshtml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								HaLive/Pages/Briefe.cshtml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| 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(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Simon Martens
					Simon Martens