PlotDirector/PlotLine/Controllers/StoryPointController.cs

21 lines
780 B
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PlotLine.Services;
namespace PlotLine.Controllers;
[Authorize]
[ResponseCache(NoStore = true, Location = ResponseCacheLocation.None)]
public sealed class StoryPointController(IStoryPointContextService context) : Controller
{
[HttpGet]
public async Task<IActionResult> Index(int projectId, int? sceneId)
{
if (projectId <= 0) return BadRequest("ProjectID is required.");
var model = await context.GetAsync(projectId, sceneId);
if (model is null) return NotFound();
return string.Equals(Request.Headers["X-Requested-With"], "XMLHttpRequest", StringComparison.OrdinalIgnoreCase)
? PartialView("_Snapshot", model.Snapshot) : View(model);
}
}