docs: a utility to batch rename category's subcategories poems
This commit is contained in:
parent
9e881628b1
commit
67c21dd056
@ -278,9 +278,12 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<td>
|
||||
<input type="submit" value="تغییر نام گروهی" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="submit" id="renameSubcats" name="renameSubcats" value="برای زیربخشها" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
@ -160,18 +160,37 @@ namespace GanjooRazor.Areas.Admin.Pages
|
||||
{
|
||||
await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response);
|
||||
|
||||
HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/recaptionpoems/{Cat.Cat.Id}", new StringContent(JsonConvert.SerializeObject(NamingModel), Encoding.UTF8, "application/json"));
|
||||
if (!response.IsSuccessStatusCode)
|
||||
if (Request.Form["renameSubcats"].Count == 1)
|
||||
{
|
||||
LastMessage = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
foreach (var subCat in Cat.Cat.Children)
|
||||
{
|
||||
HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/recaptionpoems/{subCat.Id}", new StringContent(JsonConvert.SerializeObject(NamingModel), Encoding.UTF8, "application/json"));
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastMessage = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
else
|
||||
{
|
||||
RenamingOutput = JsonConvert.DeserializeObject<string[]>(await response.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RenamingOutput = JsonConvert.DeserializeObject<string[]>(await response.Content.ReadAsStringAsync());
|
||||
HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/recaptionpoems/{Cat.Cat.Id}", new StringContent(JsonConvert.SerializeObject(NamingModel), Encoding.UTF8, "application/json"));
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastMessage = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
else
|
||||
{
|
||||
RenamingOutput = JsonConvert.DeserializeObject<string[]>(await response.Content.ReadAsStringAsync());
|
||||
}
|
||||
NamingModel.Simulate = false;
|
||||
}
|
||||
|
||||
|
||||
NamingModel.Simulate = false;
|
||||
}
|
||||
|
||||
return Page();
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"GoogleAnalyticsCode": "",
|
||||
"APIRoot": "http://localhost:3439",
|
||||
"GlobalAPIRoot": "http://localhost:3439",
|
||||
"APIRoot": "https://api.ganjoor.net",
|
||||
"GlobalAPIRoot": "https://api.ganjoor.net",
|
||||
"SiteUrl": "http://localhost:33081",
|
||||
"MockSpotify": "False",
|
||||
"Spotify": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user