/
softailor
/
gridient
Обзор
Документация
Войти
/
softailor
/
gridient
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/Gridient.Core/Controllers/ReportsController.cs
29 строк
993 B
Jenkins
Auto add
18 фев 2026, 10:19
18 фев 2026, 10:19
1e6c4f8
Код
Авторство
О чём код?
using Gridient.Core.Features.Reports.Queries; using Gridient.Core.Models; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Gridient.Core.Controllers { [Route("api/[controller]")] [ApiController] [Authorize] public class ReportsController( IMediator mediator ) : ListsBaseController { private readonly IMediator _mediator = mediator; [HttpPost(nameof(DownloadExcel))] public async Task<IActionResult> DownloadExcel([FromBody] ReportRequest request, CancellationToken cancellationToken) { var query = new DownloadExcelQuery(request); byte[] content = await _mediator.Send(query, cancellationToken); string file_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; string file_name = $"list_{DateTime.Now:yyyy_MM_dd_HH_mm}.xlsx"; return File(content, file_type, file_name); } } }