#160 find poem rhymes inside modfy page
This commit is contained in:
parent
40516404db
commit
3a0bca2427
@ -98,7 +98,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<input asp-for="ModifyModel.RhymeLetters" />
|
||||
|
||||
<a role="button" onclick="computePoemRhyme(@Request.Query["id"], '#ModifyModel_RhymeLetters')" class="actionlink">محاسبه</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@ -107,6 +107,14 @@ namespace GanjooRazor.Areas.Admin.Pages
|
||||
return Page();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetComputeRhymeAsync(int id)
|
||||
{
|
||||
var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/analysisrhyme/{id}");
|
||||
response.EnsureSuccessStatusCode();
|
||||
var rhyme = JsonConvert.DeserializeObject<GanjooRhymeAnalysisResult>(await response.Content.ReadAsStringAsync());
|
||||
return new OkObjectResult(rhyme.Rhyme);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostAsync(GanjoorModifyPageViewModel ModifyModel)
|
||||
{
|
||||
using (HttpClient secureClient = new HttpClient())
|
||||
|
||||
@ -167,6 +167,23 @@
|
||||
});
|
||||
}
|
||||
|
||||
function computePoemRhyme(poemId, elementId) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '?Handler=ComputeRhyme',
|
||||
data: {
|
||||
id: poemId
|
||||
},
|
||||
error: function () {
|
||||
alert('خطا رخ داد.');
|
||||
},
|
||||
success: function (rhyme) {
|
||||
$(elementId).val(rhyme);
|
||||
return false;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user