From 5f37b6ff46c96f42bd96a41796688859fdfb47ff Mon Sep 17 00:00:00 2001 From: ilitirit Date: Fri, 5 May 2023 22:05:04 +0200 Subject: [PATCH] Use single page for all views --- Expedience.Web/Pages/DeepDungeons.cshtml | 55 ------------------- Expedience.Web/Pages/DeepDungeons.cshtml.cs | 24 -------- Expedience.Web/Pages/Index.cshtml | 31 ++++++++++- Expedience.Web/Pages/Index.cshtml.cs | 19 +++++-- Expedience.Web/Pages/Shared/_Layout.cshtml | 12 ++-- Expedience.Web/Pages/_DeepDungeonTable.cshtml | 2 +- Expedience.Web/appsettings.Development.json | 2 +- 7 files changed, 50 insertions(+), 95 deletions(-) delete mode 100644 Expedience.Web/Pages/DeepDungeons.cshtml delete mode 100644 Expedience.Web/Pages/DeepDungeons.cshtml.cs diff --git a/Expedience.Web/Pages/DeepDungeons.cshtml b/Expedience.Web/Pages/DeepDungeons.cshtml deleted file mode 100644 index 37492cf..0000000 --- a/Expedience.Web/Pages/DeepDungeons.cshtml +++ /dev/null @@ -1,55 +0,0 @@ -@page - -@model DeepDungeonsModel - -@{ - ViewData["Title"] = "Expedience"; -} - -@section scripts { - -} - -
- - - -
diff --git a/Expedience.Web/Pages/DeepDungeons.cshtml.cs b/Expedience.Web/Pages/DeepDungeons.cshtml.cs deleted file mode 100644 index c72716a..0000000 --- a/Expedience.Web/Pages/DeepDungeons.cshtml.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using Expedience.Infrastructure.Models; -using Expedience.Web.Services; -using Microsoft.AspNetCore.Mvc.RazorPages; - -namespace Expedience.Web.Pages -{ - public class DeepDungeonsModel : PageModel - { - private readonly IApiService _apiService; - - public List? DeepDungeonRecords { get; private set; } - - public DeepDungeonsModel(IApiService apiService) - { - _apiService = apiService; - } - - public async Task OnGet(CancellationToken cancellationToken) - { - DeepDungeonRecords = await _apiService.GetDeepDungeonRecordsAsync(cancellationToken); - } - } -} \ No newline at end of file diff --git a/Expedience.Web/Pages/Index.cshtml b/Expedience.Web/Pages/Index.cshtml index 88e182a..fde7642 100644 --- a/Expedience.Web/Pages/Index.cshtml +++ b/Expedience.Web/Pages/Index.cshtml @@ -31,7 +31,8 @@ }
- + @if (Model.DutyCompletionRecords != null) + { + diff --git a/Expedience.Web/Pages/Index.cshtml.cs b/Expedience.Web/Pages/Index.cshtml.cs index 9b2d608..7be81da 100644 --- a/Expedience.Web/Pages/Index.cshtml.cs +++ b/Expedience.Web/Pages/Index.cshtml.cs @@ -1,9 +1,7 @@ -using Expedience.Infrastructure; +using System; using Expedience.Infrastructure.Models; using Expedience.Web.Services; using Microsoft.AspNetCore.Mvc.RazorPages; -using System.Diagnostics; -using static System.Runtime.InteropServices.JavaScript.JSType; namespace Expedience.Web.Pages { @@ -12,8 +10,9 @@ namespace Expedience.Web.Pages private readonly IApiService _apiService; public List? DutyCompletionRecords { get; private set; } + public List? DeepDungeonRecords { get; private set; } - public IndexModel(IApiService apiService) + public IndexModel(IApiService apiService) { _apiService = apiService; } @@ -22,7 +21,17 @@ namespace Expedience.Web.Pages { if (expac == null) expac = "EW"; - DutyCompletionRecords = await _apiService.GetDutyCompletionRecordsAsync(expac, cancellationToken); + if (expac == "DeepDungeons") + { + DutyCompletionRecords = null; + DeepDungeonRecords = await _apiService.GetDeepDungeonRecordsAsync(cancellationToken); + } + else + { + DutyCompletionRecords = await _apiService.GetDutyCompletionRecordsAsync(expac, cancellationToken); + DeepDungeonRecords = null; + } + } } } \ No newline at end of file diff --git a/Expedience.Web/Pages/Shared/_Layout.cshtml b/Expedience.Web/Pages/Shared/_Layout.cshtml index 94f3905..ba497ed 100644 --- a/Expedience.Web/Pages/Shared/_Layout.cshtml +++ b/Expedience.Web/Pages/Shared/_Layout.cshtml @@ -27,22 +27,22 @@ diff --git a/Expedience.Web/Pages/_DeepDungeonTable.cshtml b/Expedience.Web/Pages/_DeepDungeonTable.cshtml index 9dd4871..deeec56 100644 --- a/Expedience.Web/Pages/_DeepDungeonTable.cshtml +++ b/Expedience.Web/Pages/_DeepDungeonTable.cshtml @@ -4,7 +4,7 @@ @model IEnumerable } - +
diff --git a/Expedience.Web/appsettings.Development.json b/Expedience.Web/appsettings.Development.json index 3d085a4..dc4c888 100644 --- a/Expedience.Web/appsettings.Development.json +++ b/Expedience.Web/appsettings.Development.json @@ -6,5 +6,5 @@ "Microsoft.AspNetCore": "Debug" } }, - "BaseApiUrl": "https://localhost:7033" + "BaseApiUrl": "https://expedience-api.ilitirit.net" }