aboutsummaryrefslogtreecommitdiffstats
path: root/src/Pages/SalesTerms.cshtml.cs
blob: fe588392e14f09459b040e42099c1619de621f22 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System.Linq;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using VSH.Data;
using VSH.Data.Enums;

namespace VSH.Pages;

public class SalesTerms : PageModel
{
	private readonly MainDbContext _context;

	public SalesTerms(MainDbContext context) {
		context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
		_context = context;
	}

	public string TermsPageHtml { get; set; }

	public void OnGet() {
		TermsPageHtml = _context.Documents.OrderBy(c => c.Created)
								.LastOrDefault(c => c.Type == DocumentType.SALES_TERMS)
								?.Content;
	}
}