22 lines
630 B
C#
22 lines
630 B
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using PlotLine.Models;
|
|
using PlotLine.Services;
|
|
|
|
namespace PlotLine.Controllers;
|
|
|
|
[Authorize]
|
|
public sealed class NamesController(INameIntelligenceService names) : Controller
|
|
{
|
|
public async Task<IActionResult> Index([FromQuery] NameSearchFilter filter, CancellationToken cancellationToken)
|
|
{
|
|
if (filter.ProjectID <= 0)
|
|
{
|
|
return BadRequest("ProjectID is required.");
|
|
}
|
|
|
|
var model = await names.BuildLibraryAsync(filter, cancellationToken);
|
|
return model is null ? NotFound() : View(model);
|
|
}
|
|
}
|