This commit is contained in:
Hamid Reza Mohammadi 2021-07-08 16:21:05 +04:30
parent a0a22be220
commit fd63183e76
2 changed files with 11 additions and 1 deletions

View File

@ -111,6 +111,11 @@ namespace GanjooRazor.Areas.Admin.Pages
return Page();
}
/// <summary>
/// تغییر عنوان گروهی
/// </summary>
/// <param name="NamingModel"></param>
/// <returns></returns>
public async Task<IActionResult> OnPostAsync(GanjoorBatchNamingModel NamingModel)
{
await GetInformationAsync();
@ -119,7 +124,7 @@ namespace GanjooRazor.Areas.Admin.Pages
{
await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response);
HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/renamepoems/{Cat.Cat.Id}", new StringContent(JsonConvert.SerializeObject(NamingModel), Encoding.UTF8, "application/json"));
HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/recaptionpoems/{Cat.Cat.Id}", new StringContent(JsonConvert.SerializeObject(NamingModel), Encoding.UTF8, "application/json"));
response.EnsureSuccessStatusCode();
RenamingOutput = JsonConvert.DeserializeObject<string[]>(await response.Content.ReadAsStringAsync());

View File

@ -2827,6 +2827,8 @@ namespace RMuseum.Services.Implementation
if (poems.Count == 0)
return new RServiceResult<string[]>(new string[] { });
var catPage = await _context.GanjoorPages.Where(p => p.GanjoorPageType == GanjoorPageType.CatPage && p.CatId == catId).SingleAsync();
if(model.RemovePreviousPattern)
{
char[] numbers = "0123456789۰۱۲۳۴۵۶۷۸۹".ToArray();
@ -2880,6 +2882,8 @@ namespace RMuseum.Services.Implementation
{
poems[i].Title = $"{model.StartWithNotIncludingSpaces} {(i + 1).ToPersianNumbers()}";
}
poems[i].FullTitle = $"{catPage.FullTitle} » {poems[i].Title}";
}
@ -2889,6 +2893,7 @@ namespace RMuseum.Services.Implementation
{
var page = await _context.GanjoorPages.Where(p => p.Id == poem.Id).SingleAsync();
page.Title = poem.Title;
page.FullTitle = poem.FullTitle;
_context.GanjoorPages.Update(page);
}