Business és Audit log hozzáadva, WEB-en letölthető

This commit is contained in:
2025-04-28 11:35:30 +02:00
parent 2fae17fed4
commit 9ffbcd87f2
9 changed files with 441 additions and 8 deletions
@@ -0,0 +1,47 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using WorkFlowCheck.Web.Services.Interfaces;
namespace WorkFlowCheck.Web.Pages.BaseStock.AuditFiles
{
[Authorize]
public class AuditFilesPageModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private readonly ISystemService _systemService;
public AuditFilesPageModel(ILogger<IndexModel> logger, ISystemService systemService)
{
_logger = logger;
_systemService = systemService;
}
public async Task OnGet()
{
}
public async Task<JsonResult> OnGetLoadAuditFiles()
{
var results = await _systemService.GetAllLogAuditFilesAsync();
return new JsonResult(new { data = results });
}
public async Task<IActionResult> OnGetDownloadFile(string filename)
{
var response = await _systemService.DownloadAuditLogFile(filename);
if (response.IsSuccess)
{
var result = new FileContentResult(response.Data, "application/octet-stream")
{
FileDownloadName = filename,
FileContents = response.Data
};
return result;
}
else
{
return new JsonResult(new { success = false });
}
}
}
}