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 Index(int? projectId) { var model = await writerWorkspace.GetDashboardAsync(projectId); return View(model); } public async Task Chapter(int id) { var model = await writerWorkspace.GetChapterWorkflowAsync(id); return model is null ? NotFound() : View(model); } [HttpPost] [ValidateAntiForgeryToken] public async Task SaveChapterGoal(ChapterGoalEditViewModel model) { await writerWorkspace.SaveChapterGoalAsync(model); return RedirectToAction(nameof(Chapter), new { id = model.ChapterID }); } }