From 4738684f6ebacafcc391c5c61df0ef0e03f604f4 Mon Sep 17 00:00:00 2001 From: jvyden Date: Fri, 19 Nov 2021 21:51:33 -0500 Subject: [PATCH] Add BaseLayout All pages should be using this. --- .../Pages/ExternalAuth/LandingPage.cshtml | 18 ++---------------- .../Pages/ExternalAuth/LandingPage.cshtml.cs | 8 +++++--- .../Pages/Layouts/BaseLayout.cshtml | 16 ++++++++++++++++ .../Pages/Layouts/BaseLayout.cshtml.cs | 7 +++++++ ProjectLighthouse/ProjectLighthouse.csproj | 4 ---- ProjectLighthouse/Startup.cs | 2 +- 6 files changed, 31 insertions(+), 24 deletions(-) create mode 100644 ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml create mode 100644 ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs diff --git a/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml b/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml index b55f7660..53141670 100644 --- a/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml +++ b/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml @@ -1,21 +1,7 @@ @page "/" -@using LBPUnion.ProjectLighthouse.Helpers -@model LBPUnion.ProjectLighthouse.Controllers.ExternalAuth.LandingPage +@model LBPUnion.ProjectLighthouse.Pages.ExternalAuth.LandingPage @{ - Layout = null; + Layout = "Layouts/BaseLayout"; } - - - - - - Project Lighthouse External Auth - - test - - - \ No newline at end of file diff --git a/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml.cs b/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml.cs index 1259e5a7..1afeec59 100644 --- a/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml.cs +++ b/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml.cs @@ -1,10 +1,12 @@ +using JetBrains.Annotations; +using LBPUnion.ProjectLighthouse.Pages.Layouts; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; -namespace LBPUnion.ProjectLighthouse.Controllers.ExternalAuth +namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth { - public class LandingPage : PageModel + public class LandingPage : BaseLayout { + [UsedImplicitly] public IActionResult OnGet() => this.Page(); } } \ No newline at end of file diff --git a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml new file mode 100644 index 00000000..5a3d8255 --- /dev/null +++ b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml @@ -0,0 +1,16 @@ +@using LBPUnion.ProjectLighthouse.Helpers +@model LBPUnion.ProjectLighthouse.Pages.Layouts.BaseLayout + + + + + + Project Lighthouse + + +@RenderBody() + + + \ No newline at end of file diff --git a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs new file mode 100644 index 00000000..df4a1a2f --- /dev/null +++ b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs @@ -0,0 +1,7 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace LBPUnion.ProjectLighthouse.Pages.Layouts +{ + public class BaseLayout : PageModel + {} +} \ No newline at end of file diff --git a/ProjectLighthouse/ProjectLighthouse.csproj b/ProjectLighthouse/ProjectLighthouse.csproj index 3bf71b1a..b576a35c 100644 --- a/ProjectLighthouse/ProjectLighthouse.csproj +++ b/ProjectLighthouse/ProjectLighthouse.csproj @@ -32,10 +32,6 @@ - - - - diff --git a/ProjectLighthouse/Startup.cs b/ProjectLighthouse/Startup.cs index 9169a7ed..01dbe063 100644 --- a/ProjectLighthouse/Startup.cs +++ b/ProjectLighthouse/Startup.cs @@ -153,7 +153,7 @@ namespace LBPUnion.ProjectLighthouse app.UseRouting(); -// app.UseEndpoints(endpoints => endpoints.MapControllers()); + app.UseEndpoints(endpoints => endpoints.MapControllers()); app.UseEndpoints(endpoints => endpoints.MapRazorPages()); } }