fix for editing page

This commit is contained in:
Hamid Reza Mohammadi 2021-05-18 12:03:35 +04:30
parent 4b6f57b3af
commit 7628d1f586
2 changed files with 7 additions and 9 deletions

View File

@ -12,6 +12,7 @@ using System.Threading.Tasks;
namespace GanjooRazor.Areas.Admin.Pages
{
[IgnoreAntiforgeryToken(Order = 1001)]
public class ModifyPageModel : PageModel
{
@ -104,14 +105,8 @@ namespace GanjooRazor.Areas.Admin.Pages
if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
{
var putResponse = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/page/{Request.Query["id"]}", new StringContent(JsonConvert.SerializeObject(ModifyModel), Encoding.UTF8, "application/json"));
if (!putResponse.IsSuccessStatusCode)
{
LastMessage = await putResponse.Content.ReadAsStringAsync();
}
else
{
return Redirect($"/Admin/ModifyPage?id={Request.Query["id"]}&edit=true");
}
putResponse.EnsureSuccessStatusCode();
return Redirect($"/Admin/ModifyPage?id={Request.Query["id"]}&edit=true");
}
else
{

View File

@ -67,7 +67,10 @@
@if (!string.IsNullOrEmpty(Model.LastError))
{
<div class="poem">
@Model.LastError
@if (Model.LastError != null)
{
@Model.LastError
}
</div>
}
else