I created method that aquires data and converts it to excel file.
result, file and fileContent are properly set and have values, however there is no attachment or data in Postman:
StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Content-Length: 3866
Content-Type: application/octet-stream
Content-Disposition: attachment
[HttpPost]
public async Task<HttpResponseMessage> GetAnniversaryTaskListReportAsync()
{
try
{
AnniversaryTaskManagementPanelSearchModel searchModel = new AnniversaryTaskManagementPanelSearchModel();
string sheetName = "Report";
var result = await _anniversaryTaskService.SearchRksAnniversaryTasksForManagementPanel(searchModel);
var file = _reportService.ExportToXLS(searchModel, result, null, null, sheetName, true, null);
var fileContent = file.GetFile();
using (MemoryStream memoryStream = new MemoryStream(fileContent))
{
HttpResponseMessage response = new HttpResponseMessage();
response.Content = new StreamContent(memoryStream);
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
FileName = "Test.xls"
};
return response;
}
}
catch (Exception ex)
{
_logger.ErrorFormat(ex, "err GetAnniversaryTaskListReportAsync");
}
return null;
}
Is there missing something ?
I need excel file or at least data to see that its properly working. Tried chatgpt and google