PDF könyvtár letöltése

This commit is contained in:
2025-04-16 13:29:07 +02:00
parent a1d683b955
commit 5acf9ff954
10 changed files with 279 additions and 4 deletions
@@ -6,5 +6,7 @@ namespace WorkFlowCheck.Web.Services.Interfaces
{
Task<List<ImageFileDTO>> GetAllImageFilesAsync();
Task<ApiResponseDTO<byte[]>> DownloadFile(string filename);
Task<List<PDFFileDTO>> GetAllPDFFilesAsync();
Task<ApiResponseDTO<byte[]>> DownloadPDFFile(string filename);
}
}
@@ -51,5 +51,47 @@ namespace WorkFlowCheck.Web.Services
}
return retVal;
}
public async Task<List<PDFFileDTO>> GetAllPDFFilesAsync()
{
var endpoint = $"{_httpClient.BaseAddress}api/System/GetAllPDFFiles";
var retVal = new List<PDFFileDTO>();
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<List<PDFFileDTO>>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response.Data;
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<ApiResponseDTO<byte[]>> DownloadPDFFile(string filename)
{
var retVal = new ApiResponseDTO<byte[]>();
var endpoint = $"{_httpClient.BaseAddress}api/System/DownloadPDFFile/{filename}";
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<byte[]>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response;
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
}
}