This commit is contained in:
Hamid Reza Mohammadi 2023-12-21 21:13:26 +03:30
parent 99bd73cb48
commit 19d609af41
2 changed files with 10 additions and 5 deletions

View File

@ -40,7 +40,7 @@
document.getElementById('GanjoorQuotedPoem_CachedRelatedPoemPoetName').value = json.poem.category.poet.nickname;
document.getElementById('GanjoorQuotedPoem_CachedRelatedPoemPoetDeathYearInLHijri').value = json.poem.category.poet.deathYearInLHijri.toString();
document.getElementById('GanjoorQuotedPoem_CachedRelatedPoemPoetUrl').value = json.poem.category.poet.fullUrl;
document.getElementById('GanjoorQuotedPoem_CachedRelatedPoemPoetImage').value = '@(GanjooRazor.APIRoot.Url)' + json.poem.category.poet.imageUrl;
document.getElementById('GanjoorQuotedPoem_CachedRelatedPoemPoetImage').value = json.poem.category.poet.imageUrl;
document.getElementById('GanjoorQuotedPoem_CachedRelatedPoemFullTitle').value = json.poem.fullTitle;
document.getElementById('GanjoorQuotedPoem_CachedRelatedPoemFullUrl').value = json.poem.fullUrl;
@ -194,7 +194,7 @@
</tr>
<tr>
<td>
شعر مرتبط پیش از این شعر است:
این شعر قدیمی‌تر از شعر مرتبط است:
</td>
</tr>
<tr>

View File

@ -223,8 +223,9 @@ namespace GanjooRazor.Areas.Admin.Pages
{
var url = $"{APIRoot.Url}/api/ganjoor/quoted";
var payload = new StringContent(JsonConvert.SerializeObject(GanjoorQuotedPoem), Encoding.UTF8, "application/json");
bool newRecord = GanjoorQuotedPoem.Id == Guid.Empty;
HttpResponseMessage response =
GanjoorQuotedPoem.Id == Guid.Empty ?
newRecord ?
await secureClient.PostAsync(url, payload) :
await secureClient.PutAsync(url, payload);
if (!response.IsSuccessStatusCode)
@ -233,8 +234,12 @@ namespace GanjooRazor.Areas.Admin.Pages
}
else
{
GanjoorQuotedPoem = JObject.Parse(await response.Content.ReadAsStringAsync()).ToObject<GanjoorQuotedPoem>();
LastMessage = $"انجام شد. <br /><a href=\"/Admin/SuggesteQuoted/?p={GanjoorQuotedPoem.PoemId}&id={GanjoorQuotedPoem.Id}\">برگشت</a>";
if(newRecord)
{
GanjoorQuotedPoem = JObject.Parse(await response.Content.ReadAsStringAsync()).ToObject<GanjoorQuotedPoem>();
}
LastMessage = $"انجام شد. <br /><a href=\"/Admin/SuggestQuoted/?p={GanjoorQuotedPoem.PoemId}&id={GanjoorQuotedPoem.Id}\">برگشت</a>";
}
}