WebApi + ClientApp, GraphQL, Reflection

This commit is contained in:
Boris Milašinović
2026-05-06 20:55:05 +02:00
parent 8f7c704a90
commit 4fb3de19f6
196 changed files with 10395 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
using Microsoft.AspNetCore.Mvc;
using Events.FilesAPI.Features.RegistrationsExcel.Download;
using MediatR;
namespace Events.FilesAPI.Features.RegistrationsExcel;
[ApiController]
[Route("Events")]
public class DownloadRegistrationsExcelController : ControllerBase
{
private const string XlsxContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
[HttpGet("{id}/RegistrationsExcel")]
[ProducesResponseType(typeof(PhysicalFileResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<IActionResult> DownloadRegistrationsExcel(
int id,
[FromServices] IMediator mediator,
CancellationToken cancellationToken)
{
DownloadRegistrationsExcelResult result = await mediator.Send(new DownloadRegistrationsExcelQuery(id), cancellationToken);
if (!result.EventFound)
return Problem(statusCode: StatusCodes.Status404NotFound, detail: $"Invalid id = {id}");
if (result.File == null)
return Problem(statusCode: StatusCodes.Status404NotFound, detail: "Registrations Excel could not be generated.");
return PhysicalFile(result.File.PhysicalPath, XlsxContentType, result.File.FileName);
}
}