From 9383a2fb09ffb60cfe63683106945bd688affa59 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Wed, 1 Jun 2022 21:13:43 +0200 Subject: feat: Initial commit after clean slate --- src/Pages/Personvern.cshtml.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/Pages/Personvern.cshtml.cs (limited to 'src/Pages/Personvern.cshtml.cs') diff --git a/src/Pages/Personvern.cshtml.cs b/src/Pages/Personvern.cshtml.cs new file mode 100644 index 0000000..1a661c5 --- /dev/null +++ b/src/Pages/Personvern.cshtml.cs @@ -0,0 +1,25 @@ +using System.Linq; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.EntityFrameworkCore; +using VSH.Data; +using VSH.Data.Enums; + +namespace VSH.Pages; + +public class PrivacyModel : PageModel +{ + private readonly MainDbContext _context; + + public PrivacyModel(MainDbContext context) { + context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; + _context = context; + } + + public string PrivacyPolicyHtml { get; set; } + + public void OnGet() { + PrivacyPolicyHtml = _context.Documents.OrderBy(c => c.Created) + .LastOrDefault(c => c.Type == DocumentType.PRIVACY_POLICY) + ?.Content; + } +} \ No newline at end of file -- cgit v1.3