#420 /User/MySuggestedQuotes page

This commit is contained in:
Hamid Reza Mohammadi 2024-01-25 11:21:22 +03:30
parent 8f05c18126
commit 5a4738f15a
3 changed files with 7 additions and 10 deletions

View File

@ -28,14 +28,14 @@ else
}
</p>
@if (Model.SuggestedSongs.Count == 0)
@if (Model.SuggestedQuotes.Count == 0)
{
<p>
شما هنوز هیچ آهنگ مرتبطی را پیشنهاد نداده‌اید. برای آشنایی با نحوهٔ پیشنهاد آهنگ‌های مرتبط <a href="https://blog.ganjoor.net/1395/06/28/bptags/" target="_blank">اینجا</a> را ببینید.
</p>
}
@foreach (var GanjoorQuotedPoem in Model.SuggestedSongs)
@foreach (var GanjoorQuotedPoem in Model.SuggestedQuotes)
{
if (color == "gray")
color = "lightsteelblue";

View File

@ -20,7 +20,7 @@ namespace GanjooRazor.Areas.User.Pages
public List<NameIdUrlImage> PaginationLinks { get; set; }
public List<GanjoorQuotedPoemViewModel> SuggestedSongs { get; set; }
public List<GanjoorQuotedPoemViewModel> SuggestedQuotes { get; set; }
public async Task<IActionResult> OnGetAsync()
{
if (string.IsNullOrEmpty(Request.Cookies["Token"]))
@ -36,14 +36,14 @@ namespace GanjooRazor.Areas.User.Pages
{
pageNumber = int.Parse(Request.Query["page"]);
}
var response = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/song/mysuggestions/?PageNumber={pageNumber}&PageSize=20");
var response = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/quoted/suggest/?PageNumber={pageNumber}&PageSize=20");
if (!response.IsSuccessStatusCode)
{
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
return Page();
}
SuggestedSongs = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject<List<GanjoorQuotedPoemViewModel>>();
SuggestedQuotes = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject<List<GanjoorQuotedPoemViewModel>>();
string paginnationMetadata = response.Headers.GetValues("paging-headers").FirstOrDefault();
if (!string.IsNullOrEmpty(paginnationMetadata))

View File

@ -271,12 +271,9 @@ namespace GanjooRazor.Areas.User.Pages
}
else
{
if (newRecord)
{
GanjoorQuotedPoem = JObject.Parse(await response.Content.ReadAsStringAsync()).ToObject<GanjoorQuotedPoemViewModel>();
}
LastMessage = $"انجام شد. <br /><a href=\"/User/SuggestQuoted/?p={GanjoorQuotedPoem.PoemId}&id={GanjoorQuotedPoem.Id}\">برگشت</a>";
Response.Redirect("/User/MySuggestedQuotes");
}
}