PlotDirector/PlotLine/Controllers/WriterController.cs
2026-06-06 20:36:54 +01:00

31 lines
915 B
C#

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using PlotLine.Services;
using PlotLine.ViewModels;
namespace PlotLine.Controllers;
[Authorize]
public sealed class WriterController(IWriterWorkspaceService writerWorkspace) : Controller
{
public async Task<IActionResult> Index(int? projectId)
{
var model = await writerWorkspace.GetDashboardAsync(projectId);
return View(model);
}
public async Task<IActionResult> Chapter(int id)
{
var model = await writerWorkspace.GetChapterWorkflowAsync(id);
return model is null ? NotFound() : View(model);
}
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> SaveChapterGoal(ChapterGoalEditViewModel model)
{
await writerWorkspace.SaveChapterGoalAsync(model);
return RedirectToAction(nameof(Chapter), new { id = model.ChapterID });
}
}