From 9f53633112235e86e2148733324e868d57911d95 Mon Sep 17 00:00:00 2001 From: Baas-hub Date: Mon, 22 Aug 2022 11:17:06 +1200 Subject: [PATCH] Updating page to work with other changes (Azure #285) --- .../APIView/APIViewWeb/Pages/Assemblies/Samples.cshtml | 4 ++++ .../APIView/APIViewWeb/Pages/Assemblies/Samples.cshtml.cs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Samples.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Samples.cshtml index 6e63fa3ce37..6ed7a7ead57 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Samples.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Samples.cshtml @@ -1,8 +1,12 @@ @page "{id?}/{revisionId?}" @model APIViewWeb.Pages.Assemblies.UsageSamplePageModel +@using APIViewWeb.Helpers +@using APIViewWeb.Models @{ Layout = "ReviewLayout"; ViewData["Title"] = "Usage Samples"; + var userPreference = PageModelHelpers.GetUserPreference(Model._preferenceCache, User.GetGitHubLogin()) ?? new UserPreferenceModel(); + ViewData["UserPreference"] = userPreference; } diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Samples.cshtml.cs b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Samples.cshtml.cs index a45a58df8d3..b725e6a40ca 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Samples.cshtml.cs +++ b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Samples.cshtml.cs @@ -26,6 +26,7 @@ public class UsageSamplePageModel : PageModel private const string ENDPOINT_SETTING = "Endpoint"; private readonly CommentsManager _commentsManager; private readonly NotificationManager _notificationManager; + public readonly UserPreferenceCache _preferenceCache; public string Endpoint { get; } public ReviewModel Review { get; private set; } @@ -41,13 +42,15 @@ public UsageSamplePageModel( UsageSampleManager samplesManager, ReviewManager reviewManager, CommentsManager commentsManager, - NotificationManager notificationManager) + NotificationManager notificationManager, + UserPreferenceCache preferenceCache) { _samplesManager = samplesManager; _reviewManager = reviewManager; Endpoint = configuration.GetValue(ENDPOINT_SETTING); _commentsManager = commentsManager; _notificationManager = notificationManager; + _preferenceCache = preferenceCache; } [FromForm]