diff options
Diffstat (limited to 'src/Pages/Personvern.cshtml.cs')
| -rw-r--r-- | src/Pages/Personvern.cshtml.cs | 25 |
1 files changed, 25 insertions, 0 deletions
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 |
