Photo rendberakása + EF migráció
This commit is contained in:
+7
-1
@@ -104,7 +104,13 @@
|
||||
return renderAnswerType(data);
|
||||
}
|
||||
},
|
||||
{ data: "answer" },
|
||||
{ data: "answer",
|
||||
searchable: false,
|
||||
sortable: false,
|
||||
render: function ( data, type, row ) {
|
||||
return renderAnswerPhoto(data, row);
|
||||
}
|
||||
},
|
||||
{ data: null, render: function (data, type, row) {
|
||||
return renderActionButtons(row.id);
|
||||
}}
|
||||
|
||||
+25
-1
@@ -28,7 +28,31 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
|
||||
public async Task<JsonResult> OnGetLoadCheckListRows(int id)
|
||||
{
|
||||
CheckListHeaderDTO = await _checkListService.GetCheckListHeader(id);
|
||||
return new JsonResult(new { data = CheckListHeaderDTO.CheckListRowDTO });
|
||||
if (CheckListHeaderDTO.CheckListRowDTO?.Count() > 0)
|
||||
{
|
||||
foreach (var item in CheckListHeaderDTO.CheckListRowDTO)
|
||||
{
|
||||
if (item.CheckListTemplateRowDTO?.AnswerType == "P")
|
||||
{
|
||||
if (item.Photo != null && item.Photo.Length > 0)
|
||||
{
|
||||
item.Answer = ConvertToBase64(item.Photo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
data = CheckListHeaderDTO.CheckListRowDTO
|
||||
});
|
||||
}
|
||||
public string ConvertToBase64(byte[] photo)
|
||||
{
|
||||
if (photo == null || photo.Length == 0)
|
||||
return string.Empty;
|
||||
|
||||
return "data:image/jpeg;base64," + Convert.ToBase64String(photo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,9 +55,10 @@ builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
builder.Services.AddFluentValidationSetup();
|
||||
|
||||
var app = builder.Build();
|
||||
string imageDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Images");
|
||||
|
||||
|
||||
//----------------- Munkakönyvtárak létrehozása -----------------------------
|
||||
string imageDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Images");
|
||||
if (!Directory.Exists(imageDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(imageDirectory);
|
||||
|
||||
@@ -192,3 +192,9 @@ function renderAnswerType(data) {
|
||||
}
|
||||
return data;
|
||||
}
|
||||
function renderAnswerPhoto(data, row) {
|
||||
if (row.checkListTemplateRowDTO.answerType === 'P') {
|
||||
return `<img src="${data}" alt="Image" style="height: 100px; width: auto;" />`
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user