removing some more EnsureSuccessStatusCode calls
This commit is contained in:
parent
b083f0e4b0
commit
961deaf349
@ -19,135 +19,141 @@
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
||||
<link rel="search" type="application/opensearchdescription+xml" title="گنجور" href="https://ganjoor.net/search.xml" />
|
||||
<script>
|
||||
function wpopen(macagna) {
|
||||
function wpopen(macagna) {
|
||||
window.open(macagna, '_blank', 'width=600,height=700,scrollbars=yes,status=yes');
|
||||
}</script>
|
||||
</head>
|
||||
<body>
|
||||
<div style="width:95%;max-width:500px;min-width:380px;margin:auto">
|
||||
<div id="jp_container_1" class="jp-video jp-video-270p">
|
||||
<div class="jp-type-playlist">
|
||||
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
|
||||
<div id="textcnt" style="display:table;width:100%;height:400px;vertical-align: bottom;background-image: url('https://source.unsplash.com/500x400/?flowers');color:white">
|
||||
<div id="title1" style="display: table-row">
|
||||
<p style="width:100%;height:25%;text-align:center;vertical-align: middle;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
@Model.Poem.Category.Poet.Name
|
||||
</p>
|
||||
</div>
|
||||
<div id="title2" style="display: table-row">
|
||||
<p style="width:100%;height:25%;text-align:center;vertical-align: middle;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
@for (int i = 1; i < Model.Poem.Category.Cat.Ancestors.Count; i++)
|
||||
{
|
||||
<text>
|
||||
@Model.Poem.Category.Cat.Ancestors.ElementAt(i).Title »
|
||||
</text>
|
||||
|
||||
}
|
||||
@Model.Poem.Category.Cat.Title
|
||||
</p>
|
||||
</div>
|
||||
<div id="title3" style="display: table-row">
|
||||
<p style="width:100%;height:25%;text-align:center;vertical-align: middle;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
@Model.Recitation.AudioTitle
|
||||
</p>
|
||||
</div>
|
||||
<div id="title4" style="display: table-row">
|
||||
<p style="width:100%;height:25%;text-align:center;vertical-align: middle;font-family: 'Vazir';display: table-cell;font-size: 1em;text-shadow: 2px 2px 4px white;">
|
||||
به خوانش @Model.Recitation.AudioArtist
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="verse1div" style="display: table-row;visibility: hidden;">
|
||||
<div style="width:100%;height:50%;text-align:center;vertical-align: bottom;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
<p id="verse1" style="width:80%;margin:auto;background-color:rgba(0, 0, 0, .4);margin-bottom:5px">
|
||||
@if (!string.IsNullOrEmpty(Model.LastError))
|
||||
{
|
||||
<p>@Model.LastError</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div style="width:95%;max-width:500px;min-width:380px;margin:auto">
|
||||
<div id="jp_container_1" class="jp-video jp-video-270p">
|
||||
<div class="jp-type-playlist">
|
||||
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
|
||||
<div id="textcnt" style="display:table;width:100%;height:400px;vertical-align: bottom;background-image: url('https://source.unsplash.com/500x400/?flowers');color:white">
|
||||
<div id="title1" style="display: table-row">
|
||||
<p style="width:100%;height:25%;text-align:center;vertical-align: middle;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
@Model.Poem.Category.Poet.Name
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="title2" style="display: table-row">
|
||||
<p style="width:100%;height:25%;text-align:center;vertical-align: middle;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
@for (int i = 1; i < Model.Poem.Category.Cat.Ancestors.Count; i++)
|
||||
{
|
||||
<text>
|
||||
@Model.Poem.Category.Cat.Ancestors.ElementAt(i).Title »
|
||||
</text>
|
||||
|
||||
<div id="verse2div" style="display: table-row;visibility: hidden">
|
||||
<div style="width:100%;height:50%;text-align:center;vertical-align: top;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
<p id="verse2" style="width:80%;margin:auto;background-color:rgba(0, 0, 0, .4);margin-top:5px">
|
||||
}
|
||||
@Model.Poem.Category.Cat.Title
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="normaldiv" style="display: table-row;visibility: hidden">
|
||||
<div style="width:100%;height:100%;text-align:center;vertical-align: middle;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
<p id="normal" style="width:80%;margin:auto;background-color:rgba(0, 0, 0, .4);">
|
||||
<div id="title3" style="display: table-row">
|
||||
<p style="width:100%;height:25%;text-align:center;vertical-align: middle;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
@Model.Recitation.AudioTitle
|
||||
</p>
|
||||
</div>
|
||||
<div id="title4" style="display: table-row">
|
||||
<p style="width:100%;height:25%;text-align:center;vertical-align: middle;font-family: 'Vazir';display: table-cell;font-size: 1em;text-shadow: 2px 2px 4px white;">
|
||||
به خوانش @Model.Recitation.AudioArtist
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="jp-gui">
|
||||
<div class="jp-video-play">
|
||||
<button class="jp-video-play-icon" tabindex="0">پخش</button>
|
||||
</div>
|
||||
<div class="jp-interface">
|
||||
<div class="jp-progress">
|
||||
<div class="jp-seek-bar">
|
||||
<div class="jp-play-bar"></div>
|
||||
<div id="verse1div" style="display: table-row;visibility: hidden;">
|
||||
<div style="width:100%;height:50%;text-align:center;vertical-align: bottom;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
<p id="verse1" style="width:80%;margin:auto;background-color:rgba(0, 0, 0, .4);margin-bottom:5px">
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-current-time"> </div>
|
||||
<div class="jp-duration"> </div>
|
||||
<div class="jp-controls-holder">
|
||||
<div class="jp-controls">
|
||||
<button class="jp-previous" tabindex="0">قبلی</button>
|
||||
<button class="jp-play" tabindex="0">پخش</button>
|
||||
<button class="jp-next" tabindex="0">بعدی</button>
|
||||
<button class="jp-stop" tabindex="0">توقف</button>
|
||||
|
||||
<div id="verse2div" style="display: table-row;visibility: hidden">
|
||||
<div style="width:100%;height:50%;text-align:center;vertical-align: top;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
<p id="verse2" style="width:80%;margin:auto;background-color:rgba(0, 0, 0, .4);margin-top:5px">
|
||||
</p>
|
||||
</div>
|
||||
<div class="jp-volume-controls">
|
||||
<button class="jp-mute" tabindex="0">بیصدا</button>
|
||||
<button class="jp-volume-max" tabindex="0">حداکثر صدا</button>
|
||||
<div class="jp-volume-bar">
|
||||
<div class="jp-volume-bar-value"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="normaldiv" style="display: table-row;visibility: hidden">
|
||||
<div style="width:100%;height:100%;text-align:center;vertical-align: middle;font-family: 'Vazir';display: table-cell;font-size: 1.5em;text-shadow: 2px 2px 4px white;">
|
||||
<p id="normal" style="width:80%;margin:auto;background-color:rgba(0, 0, 0, .4);">
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="jp-gui">
|
||||
<div class="jp-video-play">
|
||||
<button class="jp-video-play-icon" tabindex="0">پخش</button>
|
||||
</div>
|
||||
<div class="jp-interface">
|
||||
<div class="jp-progress">
|
||||
<div class="jp-seek-bar">
|
||||
<div class="jp-play-bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-toggles">
|
||||
<button class="jp-repeat" tabindex="0">تکرار</button>
|
||||
<div class="jp-current-time"> </div>
|
||||
<div class="jp-duration"> </div>
|
||||
<div class="jp-controls-holder">
|
||||
<div class="jp-controls">
|
||||
<button class="jp-previous" tabindex="0">قبلی</button>
|
||||
<button class="jp-play" tabindex="0">پخش</button>
|
||||
<button class="jp-next" tabindex="0">بعدی</button>
|
||||
<button class="jp-stop" tabindex="0">توقف</button>
|
||||
</div>
|
||||
<div class="jp-volume-controls">
|
||||
<button class="jp-mute" tabindex="0">بیصدا</button>
|
||||
<button class="jp-volume-max" tabindex="0">حداکثر صدا</button>
|
||||
<div class="jp-volume-bar">
|
||||
<div class="jp-volume-bar-value"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-toggles">
|
||||
<button class="jp-repeat" tabindex="0">تکرار</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-details">
|
||||
<div class="jp-title"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-details">
|
||||
<div class="jp-title"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-playlist">
|
||||
<ul>
|
||||
<!-- The method Playlist.displayPlaylist() uses this unordered list -->
|
||||
<li> </li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="jp-no-solution">
|
||||
<span>نیاز به بروزآوری</span>
|
||||
جهت خوانش شعر شما یا باید از مرورگر جدیدی همچون <a href="http://getfirefox.com/">فایرفاکس</a> استفاده کنید یا افزونه <a href="http://get.adobe.com/flashplayer/" target="_blank">فلش</a> مرورگرتان را بروزآوری کنید.
|
||||
<div class="jp-playlist">
|
||||
<ul>
|
||||
<!-- The method Playlist.displayPlaylist() uses this unordered list -->
|
||||
<li> </li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="jp-no-solution">
|
||||
<span>نیاز به بروزآوری</span>
|
||||
جهت خوانش شعر شما یا باید از مرورگر جدیدی همچون <a href="http://getfirefox.com/">فایرفاکس</a> استفاده کنید یا افزونه <a href="http://get.adobe.com/flashplayer/" target="_blank">فلش</a> مرورگرتان را بروزآوری کنید.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p style="font-family: 'Vazir';font-size: 0.8em;color:darkgray">
|
||||
تصویر پسزمینهٔ خوانش یک تصویر تصادفی از سایت <a href="https://unsplash.com/" target="_blank">unsplash.com</a> است و ارتباطی با محتوای شعر ندارد.
|
||||
</p>
|
||||
<p style="font-family: 'Vazir';font-size: 0.8em;color:darkgray">
|
||||
تصویر پسزمینهٔ خوانش یک تصویر تصادفی از سایت <a href="https://unsplash.com/" target="_blank">unsplash.com</a> است و ارتباطی با محتوای شعر ندارد.
|
||||
</p>
|
||||
|
||||
|
||||
<p style="font-family: 'Vazir';font-size: 1em">
|
||||
فایل صوتی متناظر را میتوانید در قالب mp3 از <a href="@Model.Recitation.Mp3Url" download>این نشانی</a> (اندازه @Html.Raw($"{(Model.Recitation.Mp3SizeInBytes / (1024.0 * 1024.0)):0.00}".ToPersianNumbers()) مگابایت) دریافت کنید.
|
||||
</p>
|
||||
<p style="font-family: 'Vazir';font-size: 1em">
|
||||
فایل صوتی متناظر را میتوانید در قالب mp3 از <a href="@Model.Recitation.Mp3Url" download>این نشانی</a> (اندازه @Html.Raw($"{(Model.Recitation.Mp3SizeInBytes / (1024.0 * 1024.0)):0.00}".ToPersianNumbers()) مگابایت) دریافت کنید.
|
||||
</p>
|
||||
|
||||
<p style="font-family: 'Vazir';font-size: 1em">
|
||||
جهت دریافت خوانش با استفاده از گنجور رومیزی <a href="http://blog.ganjoor.net/1395/04/07/dg-274/" target="_blank">این مطلب</a> را مطالعه بفرمایید. امکان ساخت کلیپهای ویدیویی از خوانشها با استفاده از <a href="http://blog.ganjoor.net/category/gsync2vid/" target="_blank">خوانشگر گنجور رومیزی</a> وجود دارد. جهت مشارکت در خوانش اشعار <a href="http://ava.ganjoor.net/about/" target="_blank">این صفحه</a> و ویدیوهای آموزشی آن را ببینید.
|
||||
</p>
|
||||
<p style="font-family: 'Vazir';font-size: 1em">
|
||||
جهت دریافت خوانش با استفاده از گنجور رومیزی <a href="http://blog.ganjoor.net/1395/04/07/dg-274/" target="_blank">این مطلب</a> را مطالعه بفرمایید. امکان ساخت کلیپهای ویدیویی از خوانشها با استفاده از <a href="http://blog.ganjoor.net/category/gsync2vid/" target="_blank">خوانشگر گنجور رومیزی</a> وجود دارد. جهت مشارکت در خوانش اشعار <a href="http://ava.ganjoor.net/about/" target="_blank">این صفحه</a> و ویدیوهای آموزشی آن را ببینید.
|
||||
</p>
|
||||
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/js/bk.js?version=10"></script>
|
||||
<script src="~/js/vaabd.js"></script>
|
||||
<script src="~/dist/jplayer/jquery.jplayer.min.js"></script>
|
||||
<script src="~/dist/add-on/jplayer.playlist.min.js"></script>
|
||||
<script>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/js/bk.js?version=10"></script>
|
||||
<script src="~/js/vaabd.js"></script>
|
||||
<script src="~/dist/jplayer/jquery.jplayer.min.js"></script>
|
||||
<script src="~/dist/add-on/jplayer.playlist.min.js"></script>
|
||||
<script>
|
||||
var verses = [];
|
||||
|
||||
@{
|
||||
@ -292,12 +298,12 @@
|
||||
|
||||
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
|
||||
{
|
||||
<script>
|
||||
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
|
||||
{
|
||||
<script>
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
@ -308,7 +314,9 @@
|
||||
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
</script>
|
||||
}
|
||||
}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -43,6 +43,8 @@ namespace GanjooRazor.Pages
|
||||
/// </summary>
|
||||
public GanjoorPoemCompleteViewModel Poem { get; set; }
|
||||
|
||||
public string LastError { get; set; }
|
||||
|
||||
public async Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
@ -53,12 +55,20 @@ namespace GanjooRazor.Pages
|
||||
ViewData["GoogleAnalyticsCode"] = _configuration["GoogleAnalyticsCode"];
|
||||
|
||||
var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/audio/published/{Request.Query["a"]}");
|
||||
response.EnsureSuccessStatusCode();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
|
||||
Recitation = JsonConvert.DeserializeObject<PublicRecitationViewModel>(await response.Content.ReadAsStringAsync());
|
||||
|
||||
var responsePoem = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{Recitation.PoemId}?verseDetails=true&catInfo=true&rhymes=false&recitations=false&images=false&songs=false&comments=false&navigation=false");
|
||||
responsePoem.EnsureSuccessStatusCode();
|
||||
if (!responsePoem.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await responsePoem.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
|
||||
Poem = JsonConvert.DeserializeObject<GanjoorPoemCompleteViewModel>(await responsePoem.Content.ReadAsStringAsync());
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
@page
|
||||
@page
|
||||
|
||||
@model GanjooRazor.Pages.MapModel
|
||||
@{
|
||||
Layout = null;
|
||||
@ -138,19 +139,26 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
<div id="map-guide">
|
||||
<input type="range" id="rangeInput" name="rangeInput" step="1" min="0" max="@(Model.PoetGroupsWithBirthPlaces.Count-1)" value="0">
|
||||
<div class="century" id="rangeText"></div>
|
||||
<div>
|
||||
<p>
|
||||
نقشهٔ خاستگاه سخنسرایان <a href="/" style="text-decoration:none">گنجور</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.LastError))
|
||||
{
|
||||
<script>
|
||||
<p>@Model.LastError</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div id="map"></div>
|
||||
<div id="map-guide">
|
||||
<input type="range" id="rangeInput" name="rangeInput" step="1" min="0" max="@(Model.PoetGroupsWithBirthPlaces.Count-1)" value="0">
|
||||
<div class="century" id="rangeText"></div>
|
||||
<div>
|
||||
<p>
|
||||
نقشهٔ خاستگاه سخنسرایان <a href="/" style="text-decoration:none">گنجور</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
|
||||
{
|
||||
<script>
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
@ -161,7 +169,9 @@
|
||||
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
</script>
|
||||
}
|
||||
}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using RMuseum.Models.Ganjoor.ViewModels;
|
||||
|
||||
@ -12,10 +13,17 @@ namespace GanjooRazor.Pages
|
||||
{
|
||||
public class MapModel : PageModel
|
||||
{
|
||||
|
||||
public string LastError { get; set; }
|
||||
|
||||
private async Task<List<GanjoorPoetViewModel>> _PreparePoets()
|
||||
{
|
||||
var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poets");
|
||||
response.EnsureSuccessStatusCode();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return new List<GanjoorPoetViewModel>();
|
||||
}
|
||||
var poets = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject<List<GanjoorPoetViewModel>>();
|
||||
|
||||
var poetsWithBirthPlaces = poets.Where(p => !string.IsNullOrEmpty(p.BirthPlace)).ToList();
|
||||
@ -34,7 +42,11 @@ namespace GanjooRazor.Pages
|
||||
private async Task _PreparePoetGroups()
|
||||
{
|
||||
var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/centuries");
|
||||
response.EnsureSuccessStatusCode();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return;
|
||||
}
|
||||
var poetGroups = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject<List<GanjoorCenturyViewModel>>();
|
||||
PoetGroupsWithBirthPlaces = new List<GanjoorCenturyViewModel>();
|
||||
PoetGroupsWithBirthPlaces.Add
|
||||
|
||||
@ -73,7 +73,11 @@ namespace GanjooRazor.Pages
|
||||
};
|
||||
|
||||
var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/users/captchaimage");
|
||||
response.EnsureSuccessStatusCode();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
|
||||
ForgotPasswordViewModel.CaptchaImageId = JsonConvert.DeserializeObject<Guid>(await response.Content.ReadAsStringAsync());
|
||||
|
||||
@ -95,7 +99,11 @@ namespace GanjooRazor.Pages
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
|
||||
response = await _httpClient.GetAsync($"{APIRoot.Url}/api/users/captchaimage");
|
||||
response.EnsureSuccessStatusCode();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
|
||||
ModelState.Clear();
|
||||
|
||||
|
||||
@ -22,170 +22,177 @@
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="hdr2" class="clearfix">
|
||||
<h1><a href="/" title="گنجور"><img src="/image/ganjadabk.gif" alt="گنجور" /></a></h1>
|
||||
<div class="actionbox">
|
||||
<form action="/search" method="get" id="searchform">
|
||||
<input type="text" name="s" id="s" class="inputText" value="@Model.Query" placeholder="جستجو" />
|
||||
<select name="author" id="author" onchange="onSelectedPoetChanged()">
|
||||
|
||||
@{
|
||||
if (Model.PoetId != 0)
|
||||
{
|
||||
<option value="0">در آثار همهٔ سخنوران</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="0" selected>در آثار همهٔ سخنوران</option>
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(Model.LastError))
|
||||
{
|
||||
@Model.LastError
|
||||
}
|
||||
else
|
||||
{
|
||||
<div id="hdr2" class="clearfix">
|
||||
<h1><a href="/" title="گنجور"><img src="/image/ganjadabk.gif" alt="گنجور" /></a></h1>
|
||||
<div class="actionbox">
|
||||
<form action="/search" method="get" id="searchform">
|
||||
<input type="text" name="s" id="s" class="inputText" value="@Model.Query" placeholder="جستجو" />
|
||||
<select name="author" id="author" onchange="onSelectedPoetChanged()">
|
||||
|
||||
if (Model.Poets != null)
|
||||
{
|
||||
foreach (RMuseum.Models.Ganjoor.ViewModels.GanjoorPoetViewModel poet in Model.Poets)
|
||||
@{
|
||||
if (Model.PoetId != 0)
|
||||
{
|
||||
if (poet.Id == Model.PoetId)
|
||||
{
|
||||
<option value="@poet.Id" selected>@poet.Name</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@poet.Id">@poet.Name</option>
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
@{
|
||||
if (Model.Poet != null)
|
||||
{
|
||||
<select name="cat" id="cat" style="width:150px">
|
||||
@if (Model.CatId == 0)
|
||||
{
|
||||
<option value="0" selected>در همهٔ بخشها</option>
|
||||
<option value="0">در آثار همهٔ سخنوران</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="0">در همهٔ بخشها</option>
|
||||
<option value="0" selected>در آثار همهٔ سخنوران</option>
|
||||
}
|
||||
|
||||
@{
|
||||
foreach (var gran in Model.Poet.Cat.Ancestors)
|
||||
if (Model.Poets != null)
|
||||
{
|
||||
foreach (RMuseum.Models.Ganjoor.ViewModels.GanjoorPoetViewModel poet in Model.Poets)
|
||||
{
|
||||
@if (Model.CatId == gran.Id)
|
||||
if (poet.Id == Model.PoetId)
|
||||
{
|
||||
<option value="@gran.Id" selected>@gran.Title</option>
|
||||
<option value="@poet.Id" selected>@poet.Name</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@gran.Id">@gran.Title</option>
|
||||
<option value="@poet.Id">@poet.Name</option>
|
||||
}
|
||||
|
||||
}
|
||||
@if (Model.CatId == Model.Poet.Cat.Id)
|
||||
}
|
||||
}
|
||||
</select>
|
||||
@{
|
||||
if (Model.Poet != null)
|
||||
{
|
||||
<select name="cat" id="cat" style="width:150px">
|
||||
@if (Model.CatId == 0)
|
||||
{
|
||||
<option value="@Model.Poet.Cat.Id" selected>@Model.Poet.Cat.Title</option>
|
||||
<option value="0" selected>در همهٔ بخشها</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@Model.Poet.Cat.Id">@Model.Poet.Cat.Title</option>
|
||||
<option value="0">در همهٔ بخشها</option>
|
||||
}
|
||||
|
||||
|
||||
foreach (var child in Model.Poet.Cat.Children)
|
||||
{
|
||||
@if (Model.CatId == child.Id)
|
||||
@{
|
||||
foreach (var gran in Model.Poet.Cat.Ancestors)
|
||||
{
|
||||
<option value="@child.Id" selected>@child.Title</option>
|
||||
@if (Model.CatId == gran.Id)
|
||||
{
|
||||
<option value="@gran.Id" selected>@gran.Title</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@gran.Id">@gran.Title</option>
|
||||
}
|
||||
|
||||
}
|
||||
@if (Model.CatId == Model.Poet.Cat.Id)
|
||||
{
|
||||
<option value="@Model.Poet.Cat.Id" selected>@Model.Poet.Cat.Title</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@child.Id">@child.Title</option>
|
||||
<option value="@Model.Poet.Cat.Id">@Model.Poet.Cat.Title</option>
|
||||
}
|
||||
|
||||
|
||||
foreach (var child in Model.Poet.Cat.Children)
|
||||
{
|
||||
@if (Model.CatId == child.Id)
|
||||
{
|
||||
<option value="@child.Id" selected>@child.Title</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@child.Id">@child.Title</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</select>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<input type="submit" value="بیاب" />
|
||||
</form>
|
||||
</div><!-- .actionbox -->
|
||||
</div><!-- #hdr2 -->
|
||||
<input type="submit" value="بیاب" />
|
||||
</form>
|
||||
</div><!-- .actionbox -->
|
||||
</div><!-- #hdr2 -->
|
||||
|
||||
<div id="fa">
|
||||
<div id="fa">
|
||||
|
||||
|
||||
|
||||
<div id="maincnt">
|
||||
<div id="maincnt">
|
||||
|
||||
<div class="spacer"> </div>
|
||||
<div class="spacer"> </div>
|
||||
|
||||
@if (Model.Poems == null)
|
||||
{
|
||||
<div class="poem">
|
||||
<h2>شعری با مشخصات مورد نظر شما پیدا نشد.</h2>
|
||||
<p>
|
||||
<strong>توصیههایی برای دستیابی به نتیجهٔ مطلوبتر در جستجو:</strong>
|
||||
</p>
|
||||
<p>
|
||||
الف) <strong>به جای جستجوی متن کامل یک بیت بهتر است حروف کلیدی آن را وارد کنید.</strong> از آنجا که اشعار به صورتهای مختلف در نسخههای متفاوت نقل شدهاند ممکن است چیزی که شما در ذهن دارید با چیزی که در پایگاه ما ثبت شده متفاوت باشد. به عنوان نمونه مصرع «کشتی شکستگانیم ای باد شرطه برخیز» از حافظ در بعضی از نسخهها به صورت «کشتی نشستگانیم ای باد شرطه برخیز» ضبط شده و شما با تایپ صورت صورت دوم آن را در گنجور نخواهید یافت. بهتر است برای یافتن این شعر کلماتی مانند کشتی و شرطه را جستجو کنیم.
|
||||
</p>
|
||||
<p>
|
||||
ب) کلماتی را که ممکن است به صورت جدا یا سر هم نوشته شوند در گام اول به صورت جدا امتحان کنید (<strong>می شود</strong> و نه <del>میشود</del> یا <del>میشود</del>).
|
||||
</p>
|
||||
<p>
|
||||
ج) در صورتی که نام شاعر را میدانید بهتر است از طریق لیست بازشوی جلوی جعبهٔ جستجو نام او را انتخاب کنید. این توصیه برای زمانی مناسب است که جستجوی عبارت مورد نظر شما باعث میشود آثار شاعرانی که مورد نظر شما نیستند در صدر نتایج قرار گیرد و به این وسیله شما میخواهید به فهرست محدودتری از نتایج دست پیدا کنید.
|
||||
</p>
|
||||
<p>
|
||||
د) در صورتی که با فنون اولیهٔ جستجو آشنا نیستید یا <strong>معمولاً جستجوهایتان به نتیجهٔ مطلوب نمیرسد</strong> بد نیست نگاهی به <a href="http://hrmoh.ir/1385/04/18/howto-search-better/" title="توصیه هایی برای جستجوی بهتر در اینترنت">این نوشته</a> بیندازید.
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
foreach (var poem in Model.Poems)
|
||||
@if (Model.Poems == null)
|
||||
{
|
||||
|
||||
<div class="sitem">
|
||||
<h2>
|
||||
<a href="@poem.FullUrl">@poem.FullTitle</a>
|
||||
</h2>
|
||||
<div class="spacer"> </div>
|
||||
<div class="sit">
|
||||
|
||||
@Html.Raw(poem.PlainText)
|
||||
|
||||
<p>
|
||||
<br>
|
||||
<a href="@poem.FullUrl">متن کامل شعر را ببینید ...</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<img src="@($"{GanjooRazor.APIRoot.InternetUrl}{poem.Category.Poet.ImageUrl}")" alt="@($"{poem.Category.Poet.Name}")" />
|
||||
|
||||
<div class="spacer"> </div>
|
||||
<div class="poem">
|
||||
<h2>شعری با مشخصات مورد نظر شما پیدا نشد.</h2>
|
||||
<p>
|
||||
<strong>توصیههایی برای دستیابی به نتیجهٔ مطلوبتر در جستجو:</strong>
|
||||
</p>
|
||||
<p>
|
||||
الف) <strong>به جای جستجوی متن کامل یک بیت بهتر است حروف کلیدی آن را وارد کنید.</strong> از آنجا که اشعار به صورتهای مختلف در نسخههای متفاوت نقل شدهاند ممکن است چیزی که شما در ذهن دارید با چیزی که در پایگاه ما ثبت شده متفاوت باشد. به عنوان نمونه مصرع «کشتی شکستگانیم ای باد شرطه برخیز» از حافظ در بعضی از نسخهها به صورت «کشتی نشستگانیم ای باد شرطه برخیز» ضبط شده و شما با تایپ صورت صورت دوم آن را در گنجور نخواهید یافت. بهتر است برای یافتن این شعر کلماتی مانند کشتی و شرطه را جستجو کنیم.
|
||||
</p>
|
||||
<p>
|
||||
ب) کلماتی را که ممکن است به صورت جدا یا سر هم نوشته شوند در گام اول به صورت جدا امتحان کنید (<strong>می شود</strong> و نه <del>میشود</del> یا <del>میشود</del>).
|
||||
</p>
|
||||
<p>
|
||||
ج) در صورتی که نام شاعر را میدانید بهتر است از طریق لیست بازشوی جلوی جعبهٔ جستجو نام او را انتخاب کنید. این توصیه برای زمانی مناسب است که جستجوی عبارت مورد نظر شما باعث میشود آثار شاعرانی که مورد نظر شما نیستند در صدر نتایج قرار گیرد و به این وسیله شما میخواهید به فهرست محدودتری از نتایج دست پیدا کنید.
|
||||
</p>
|
||||
<p>
|
||||
د) در صورتی که با فنون اولیهٔ جستجو آشنا نیستید یا <strong>معمولاً جستجوهایتان به نتیجهٔ مطلوب نمیرسد</strong> بد نیست نگاهی به <a href="http://hrmoh.ir/1385/04/18/howto-search-better/" title="توصیه هایی برای جستجوی بهتر در اینترنت">این نوشته</a> بیندازید.
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
foreach (var poem in Model.Poems)
|
||||
{
|
||||
|
||||
<div class="spacer"> </div>
|
||||
<div class="sitem">
|
||||
<h2>
|
||||
<a href="@poem.FullUrl">@poem.FullTitle</a>
|
||||
</h2>
|
||||
<div class="spacer"> </div>
|
||||
<div class="sit">
|
||||
|
||||
@Html.Raw(Model.PagingToolsHtml)
|
||||
@Html.Raw(poem.PlainText)
|
||||
|
||||
<p>
|
||||
<br>
|
||||
<a href="@poem.FullUrl">متن کامل شعر را ببینید ...</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<img src="@($"{GanjooRazor.APIRoot.InternetUrl}{poem.Category.Poet.ImageUrl}")" alt="@($"{poem.Category.Poet.Name}")" />
|
||||
|
||||
<div class="spacer"> </div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="spacer"> </div>
|
||||
|
||||
@Html.Raw(Model.PagingToolsHtml)
|
||||
|
||||
</div>
|
||||
|
||||
<partial name="_InlineLoginPartialForSearch" model="Model" />
|
||||
|
||||
<partial name="_FooterPartial" model="null" />
|
||||
|
||||
</div>
|
||||
|
||||
<partial name="_InlineLoginPartialForSearch" model="Model" />
|
||||
<script src="/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="/js/bk.js?version=10"></script>
|
||||
<script src="/js/vaabd.js"></script>
|
||||
|
||||
<partial name="_FooterPartial" model="null" />
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="/js/bk.js?version=10"></script>
|
||||
<script src="/js/vaabd.js"></script>
|
||||
|
||||
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
|
||||
{
|
||||
<script>
|
||||
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
|
||||
{
|
||||
<script>
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
@ -196,9 +203,12 @@
|
||||
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
</script>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@ -74,32 +74,44 @@ namespace GanjooRazor.Pages
|
||||
[BindProperty]
|
||||
public LoginViewModel LoginViewModel { get; set; }
|
||||
|
||||
private async Task preparePoets()
|
||||
public string LastError { get; set; }
|
||||
|
||||
private async Task<bool> preparePoets()
|
||||
{
|
||||
var cacheKey = $"/api/ganjoor/poets";
|
||||
if (!_memoryCache.TryGetValue(cacheKey, out List<GanjoorPoetViewModel> poets))
|
||||
{
|
||||
var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poets");
|
||||
response.EnsureSuccessStatusCode();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return false;
|
||||
}
|
||||
poets = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject<List<GanjoorPoetViewModel>>();
|
||||
_memoryCache.Set(cacheKey, poets);
|
||||
}
|
||||
|
||||
Poets = poets;
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task preparePoet()
|
||||
private async Task<bool> preparePoet()
|
||||
{
|
||||
var cacheKey = $"/api/ganjoor/poet/{PoetId}";
|
||||
if (!_memoryCache.TryGetValue(cacheKey, out GanjoorPoetCompleteViewModel poet))
|
||||
{
|
||||
var poetResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poet/{PoetId}");
|
||||
poetResponse.EnsureSuccessStatusCode();
|
||||
if (!poetResponse.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await poetResponse.Content.ReadAsStringAsync());
|
||||
return false;
|
||||
}
|
||||
poet = JObject.Parse(await poetResponse.Content.ReadAsStringAsync()).ToObject<GanjoorPoetCompleteViewModel>();
|
||||
_memoryCache.Set(cacheKey, poet);
|
||||
}
|
||||
|
||||
Poet = poet;
|
||||
return true;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetPoetInformationAsync(int id)
|
||||
@ -110,7 +122,10 @@ namespace GanjooRazor.Pages
|
||||
if (!_memoryCache.TryGetValue(cacheKey, out GanjoorPoetCompleteViewModel poet))
|
||||
{
|
||||
var poetResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poet/{id}");
|
||||
poetResponse.EnsureSuccessStatusCode();
|
||||
if (!poetResponse.IsSuccessStatusCode)
|
||||
{
|
||||
return BadRequest(JsonConvert.DeserializeObject<string>(await poetResponse.Content.ReadAsStringAsync()));
|
||||
}
|
||||
poet = JObject.Parse(await poetResponse.Content.ReadAsStringAsync()).ToObject<GanjoorPoetCompleteViewModel>();
|
||||
_memoryCache.Set(cacheKey, poet);
|
||||
}
|
||||
@ -133,7 +148,8 @@ namespace GanjooRazor.Pages
|
||||
|
||||
//todo: use html master layout or make it partial
|
||||
// 1. poets
|
||||
await preparePoets();
|
||||
if (false == (await preparePoets()))
|
||||
return Page();
|
||||
|
||||
var poetName = Poets.SingleOrDefault(p => p.Id == PoetId);
|
||||
if (poetName != null)
|
||||
@ -155,8 +171,8 @@ namespace GanjooRazor.Pages
|
||||
|
||||
if (PoetId != 0)
|
||||
{
|
||||
await preparePoet();
|
||||
|
||||
if (false == (await preparePoet()))
|
||||
return Page();
|
||||
}
|
||||
|
||||
// 2. search verses
|
||||
@ -172,7 +188,11 @@ namespace GanjooRazor.Pages
|
||||
{
|
||||
searchQueryResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poems/search?term={Query}&poetId={PoetId}&catId={CatId}&PageNumber={pageNumber}&PageSize=20");
|
||||
|
||||
searchQueryResponse.EnsureSuccessStatusCode();
|
||||
if (!searchQueryResponse.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await searchQueryResponse.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
|
||||
Poems = JArray.Parse(await searchQueryResponse.Content.ReadAsStringAsync()).ToObject<List<GanjoorPoemCompleteViewModel>>();
|
||||
}
|
||||
|
||||
@ -71,7 +71,11 @@ namespace GanjooRazor.Pages
|
||||
};
|
||||
|
||||
var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/users/captchaimage");
|
||||
response.EnsureSuccessStatusCode();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
|
||||
SignUpViewModel.CaptchaImageId = JsonConvert.DeserializeObject<Guid>(await response.Content.ReadAsStringAsync());
|
||||
|
||||
@ -94,7 +98,11 @@ namespace GanjooRazor.Pages
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
|
||||
response = await _httpClient.GetAsync($"{APIRoot.Url}/api/users/captchaimage");
|
||||
response.EnsureSuccessStatusCode();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
|
||||
ModelState.Clear();
|
||||
|
||||
|
||||
@ -84,7 +84,6 @@ namespace GanjooRazor.Pages
|
||||
ErrorMessage = JsonConvert.DeserializeObject<string>(await responseLanguages.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
responseLanguages.EnsureSuccessStatusCode();
|
||||
|
||||
var allLanguages = JsonConvert.DeserializeObject<GanjoorLanguage[]>(await responseLanguages.Content.ReadAsStringAsync());
|
||||
|
||||
@ -94,7 +93,6 @@ namespace GanjooRazor.Pages
|
||||
ErrorMessage = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
Translations = JsonConvert.DeserializeObject<GanjoorPoemTranslationViewModel[]>(await response.Content.ReadAsStringAsync());
|
||||
|
||||
@ -122,20 +120,13 @@ namespace GanjooRazor.Pages
|
||||
|
||||
if (Translation != null)
|
||||
LanguageId = Translation.Language.Id;
|
||||
|
||||
|
||||
|
||||
var responsePoem = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{PoemId}?verseDetails=true&catInfo=true&rhymes=false&recitations=false&images=false&songs=false&comments=false&navigation=true");
|
||||
if (!responsePoem.IsSuccessStatusCode)
|
||||
{
|
||||
ErrorMessage = JsonConvert.DeserializeObject<string>(await responsePoem.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
|
||||
responsePoem.EnsureSuccessStatusCode();
|
||||
|
||||
Poem = JsonConvert.DeserializeObject<GanjoorPoemCompleteViewModel>(await responsePoem.Content.ReadAsStringAsync());
|
||||
|
||||
return Page();
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,11 @@ namespace GanjooRazor.Pages
|
||||
if (!string.IsNullOrEmpty(filterUserId))
|
||||
{
|
||||
var responseUserProfile = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/user/profile/{filterUserId}");
|
||||
responseUserProfile.EnsureSuccessStatusCode();
|
||||
if (!responseUserProfile.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await responseUserProfile.Content.ReadAsStringAsync());
|
||||
return;
|
||||
}
|
||||
|
||||
GanjoorUserPublicProfile profile = JsonConvert.DeserializeObject<GanjoorUserPublicProfile>(await responseUserProfile.Content.ReadAsStringAsync());
|
||||
|
||||
@ -99,9 +103,11 @@ namespace GanjooRazor.Pages
|
||||
}
|
||||
|
||||
var response = await _httpClient.GetAsync(url);
|
||||
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return;
|
||||
}
|
||||
|
||||
string paginnationMetadata = response.Headers.GetValues("paging-headers").FirstOrDefault();
|
||||
PaginationMetadata paginationMetadata = JsonConvert.DeserializeObject<PaginationMetadata>(paginnationMetadata);
|
||||
|
||||
@ -42,7 +42,11 @@ namespace GanjooRazor.Pages
|
||||
string url = $"{APIRoot.Url}/api/ganjoor/poems/similar?PageNumber={pageNumber}&PageSize=20&metre={metre}&rhyme={rhyme}";
|
||||
var response = await _httpClient.GetAsync(url);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return;
|
||||
}
|
||||
|
||||
var poems = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject<List<GanjoorPoemCompleteViewModel>>();
|
||||
|
||||
|
||||
@ -7,7 +7,6 @@ using RSecurityBackend.Models.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GanjooRazor.Pages
|
||||
@ -35,7 +34,11 @@ namespace GanjooRazor.Pages
|
||||
|
||||
var response = await _httpClient.GetAsync(url);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return;
|
||||
}
|
||||
|
||||
GanjoorPage.Title = "شعرهای ";
|
||||
if (poetId != 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user