PlotDirector/PlotLine/Controllers/PlotLineWorkspaceController.cs

40 lines
1.5 KiB
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PlotLine.Services;
namespace PlotLine.Controllers;
[Authorize]
public sealed class PlotLineWorkspaceController(IPlotLineWorkspaceService workspace) : Controller
{
public async Task<IActionResult> Index(
int projectId,
int? bookId,
[FromQuery(Name = "plotLineId")] int[]? plotLineIds,
[FromQuery(Name = "threadId")] int[]? threadIds,
int? scenarioId,
bool showSuggestions = false)
{
var model = await workspace.GetAsync(projectId, bookId, plotLineIds, threadIds, scenarioId, showSuggestions, false);
return model is null ? NotFound() : View(model);
}
public async Task<IActionResult> Unattributed(int projectId, int? bookId, int? scenarioId)
{
var model = await workspace.GetAsync(projectId, bookId, [], [], scenarioId, false, true);
return model is null ? NotFound() : View("Index", model);
}
public async Task<IActionResult> Inspector(int projectId, int? bookId, int sceneId, int? scenarioId)
{
var model = await workspace.GetInspectorAsync(projectId, bookId, sceneId, scenarioId);
return model is null ? NotFound() : PartialView("_Inspector", model);
}
public async Task<IActionResult> Manuscript(int projectId, int? bookId, int sceneId)
{
var model = await workspace.GetManuscriptAsync(projectId, bookId, sceneId);
return model is null ? NotFound() : PartialView("_Manuscript", model);
}
}