1b3a8b493e
deploy / deploy (push) Failing after 1m21s
Full rewrite of the portfolio site from Next.js 14 to .NET 10: - ASP.NET Core 10 Razor Pages, no Node.js dependency - EF Core 10 + SQLite (same schema as before — data survives upgrade) - Cookie authentication (same single-password model) - Resend contact form via HttpClient - Bilingual FA/EN via locale cookie + BasePageModel - All UI ported to Razor Pages with Tailwind CDN + custom CSS - Vanilla JS: particles, typewriter, cursor, animations, portfolio modal - Dockerfile: SDK 10.0-alpine → aspnet 10.0-alpine (no npm/Node needed) - CI/CD: dropped NPM_TOKEN, ADMIN_SESSION_SECRET — pure dotnet publish Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using System.Text.Json;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using SoroushAsadi.Services;
|
|
|
|
namespace SoroushAsadi.Pages.Admin.Sections;
|
|
|
|
[Authorize]
|
|
public class SectionEditModel(ContentService content) : PageModel
|
|
{
|
|
[BindProperty(SupportsGet = true)]
|
|
public string SectionKey { get; set; } = "";
|
|
|
|
public string CurrentJson { get; private set; } = "{\n \"fa\": {},\n \"en\": {}\n}";
|
|
public string Message { get; private set; } = "";
|
|
|
|
public void OnGet()
|
|
{
|
|
var node = content.GetSection(SectionKey);
|
|
if (node is not null)
|
|
CurrentJson = node.ToJsonString(new JsonSerializerOptions { WriteIndented = true });
|
|
}
|
|
|
|
public IActionResult OnPost(string json)
|
|
{
|
|
try
|
|
{
|
|
// Validate JSON
|
|
JsonDocument.Parse(json);
|
|
content.SaveSection(SectionKey, json);
|
|
Message = "Saved.";
|
|
CurrentJson = json;
|
|
return Page();
|
|
}
|
|
catch (JsonException ex)
|
|
{
|
|
Message = $"Invalid JSON: {ex.Message}";
|
|
CurrentJson = json;
|
|
return Page();
|
|
}
|
|
}
|
|
}
|