diff --git a/GanjooRazor/Pages/AudioClip.cshtml b/GanjooRazor/Pages/AudioClip.cshtml index ebf7127a..03bc37a3 100644 --- a/GanjooRazor/Pages/AudioClip.cshtml +++ b/GanjooRazor/Pages/AudioClip.cshtml @@ -143,7 +143,7 @@

- + diff --git a/GanjooRazor/Pages/Index.cshtml b/GanjooRazor/Pages/Index.cshtml index cd1c6c79..a1a80768 100644 --- a/GanjooRazor/Pages/Index.cshtml +++ b/GanjooRazor/Pages/Index.cshtml @@ -25,7 +25,7 @@ - + @if (Model.IsHomePage) { diff --git a/GanjooRazor/Pages/Index.cshtml.cs b/GanjooRazor/Pages/Index.cshtml.cs index 833995bf..ea530f03 100644 --- a/GanjooRazor/Pages/Index.cshtml.cs +++ b/GanjooRazor/Pages/Index.cshtml.cs @@ -478,6 +478,21 @@ namespace GanjooRazor.Pages Poets = poets; } + public async Task OnGetPoetInformationAsync(int id) + { + if (id == 0) + return new OkObjectResult(null); + var cacheKey = $"/api/ganjoor/poet/{id}"; + if (!_memoryCache.TryGetValue(cacheKey, out GanjoorPoetCompleteViewModel poet)) + { + var poetResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poet/{id}"); + poetResponse.EnsureSuccessStatusCode(); + poet = JObject.Parse(await poetResponse.Content.ReadAsStringAsync()).ToObject(); + _memoryCache.Set(cacheKey, poet); + } + return new OkObjectResult(poet); + } + private async Task _PreparePoetGroups() { var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/centuries"); diff --git a/GanjooRazor/Pages/Search.cshtml b/GanjooRazor/Pages/Search.cshtml index b771160e..261f3573 100644 --- a/GanjooRazor/Pages/Search.cshtml +++ b/GanjooRazor/Pages/Search.cshtml @@ -22,22 +22,21 @@ -

گنجور

- @{ if (Model.PoetId != 0) { - + } else { - + } if (Model.Poets != null) @@ -63,11 +62,11 @@ - @{ if (Model.GanjoorPage != null && Model.GanjoorPage.PoetOrCat != null) { - + } else { - + } if (Model.Poets != null) @@ -39,7 +39,7 @@ if (!Model.IsPoetPage && Model.GanjoorPage != null && Model.GanjoorPage.PoetOrCat != null) {