docs: #275 getting list of poet speclines in the UI
This commit is contained in:
parent
aa754469b4
commit
5253aa8e9f
@ -91,6 +91,21 @@
|
||||
<div class="clear-both">
|
||||
@Model.Poet.Description
|
||||
</div>
|
||||
|
||||
<div class="century">
|
||||
نکات مهم دربارهٔ @Model.Poet.Nickname
|
||||
</div>
|
||||
|
||||
@foreach (var line in Model.SpecLines)
|
||||
{
|
||||
<div class="clear-both">
|
||||
@line.Contents
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="clear-both">
|
||||
<p>شما نکتهای اضافه کنید</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -18,6 +18,8 @@ namespace GanjooRazor.Pages
|
||||
|
||||
public GanjoorPoetViewModel Poet { get; set; }
|
||||
|
||||
public List<GanjoorPoetSuggestedSpecLineViewModel> SpecLines { get; set; }
|
||||
|
||||
private async Task<List<GanjoorPoetViewModel>> _PreparePoets()
|
||||
{
|
||||
var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poets");
|
||||
@ -28,7 +30,6 @@ namespace GanjooRazor.Pages
|
||||
}
|
||||
var poets = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject<List<GanjoorPoetViewModel>>();
|
||||
|
||||
|
||||
foreach (var poet in poets)
|
||||
{
|
||||
poet.ImageUrl = $"{APIRoot.InternetUrl}{poet.ImageUrl}";
|
||||
@ -51,6 +52,14 @@ namespace GanjooRazor.Pages
|
||||
}
|
||||
Poet = JObject.Parse(await response.Content.ReadAsStringAsync()).ToObject<GanjoorPoetCompleteViewModel>().Poet;
|
||||
Poet.ImageUrl = $"{APIRoot.InternetUrl}{Poet.ImageUrl}";
|
||||
|
||||
var responseLines = await _httpClient.GetAsync($"{APIRoot.Url}/api/poetspecs/poet/{Poet.Id}");
|
||||
if (!responseLines.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await responseLines.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
SpecLines = JArray.Parse(await responseLines.Content.ReadAsStringAsync()).ToObject<List<GanjoorPoetSuggestedSpecLineViewModel>>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user