using Microsoft.AspNetCore.Mvc; using PlotLine.Data; using PlotLine.Services; namespace PlotLine.ViewComponents; public sealed class StoryElementReferencesViewComponent( ICurrentUserService currentUser, StoryElementReferenceRepository references) : ViewComponent { public async Task InvokeAsync(StoryElementType entityType, int entityId) { if (currentUser.UserId is not int userId) return Content(""); var model = await references.ListAsync(userId, new(entityType, entityId)); return model is null ? Content("") : View(model); } }