fixed download if no image return empty

This commit is contained in:
2026-09-20 15:30:22 +10:00
parent 3d83e95613
commit 5292b99af6
5 changed files with 60 additions and 14 deletions
@@ -111,12 +111,21 @@ public class FileUploadController : ControllerBase
return Ok(ret);
}
[HttpPost("[action]")]
public async Task<IActionResult> DownloadPersonPhoto(DownloadFileCriteria criteria)
public async Task<IActionResult> DownloadPersonPhotoById(DeleteCriteria<int> criteria)
{
var result = await _personPhoto.DownloadPersonPhoto(criteria.Id,criteria.PhotoType ,criteria.FileName);
var result = await _personPhoto.DownloadPersonPhotoById(criteria.Id);
if (result.StatusCode > 0)
return File(result.Data.Content, result.Data.ContentType, result.Data.FileName);
else
return NotFound("not found image");
}
[HttpPost("[action]")]
public async Task<IActionResult> DownloadPersonPhotoPerson(DownloadFileCriteria criteria)
{
var result = await _personPhoto.DownloadPersonPhotoPerson(criteria.Id,criteria.PhotoType ,criteria.FileName);
if (result.StatusCode > 0)
return File(result.Data.Content, result.Data.ContentType, result.Data.FileName);
else
@@ -126,7 +135,7 @@ public class FileUploadController : ControllerBase
public async Task<IActionResult> DownloadPersonPhoto64(DownloadFileCriteria criteria)
{
var result = await _personPhoto.DownloadPersonPhoto(criteria.Id,criteria.PhotoType ,criteria.FileName);
var result = await _personPhoto.DownloadPersonPhotoPerson(criteria.Id,criteria.PhotoType ,criteria.FileName);
if (result.StatusCode > 0)
{
byte[] file64 = result.Data.Content;