CheckListRow edit

This commit is contained in:
2025-03-28 17:35:29 +01:00
parent 728b6a8a9e
commit 77796f3247
7 changed files with 286 additions and 1 deletions
@@ -363,6 +363,60 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<CheckListRowDTO> GetCheckListRowAsync(int id)
{
var retVal = new CheckListRowDTO();
try
{
var res = await _dbContext.CheckListRows
.Include(i => i.CheckListTemplateRow)
.Where(w => w.Id == id)
.AsNoTracking()
.FirstOrDefaultAsync();
if (res != null)
{
retVal = _mapper.Map<CheckListRowDTO>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckListRowDTO> UpdateCheckListRowAsync(CheckListRowDTO checkListRowDTO)
{
var retVal = new CheckListRowDTO() { };
try
{
if (checkListRowDTO.Id == 0)
{
}
else
{
var checkListRow = await _dbContext.CheckListRows
.Where(w => w.Id == checkListRowDTO.Id)
.FirstOrDefaultAsync();
if (checkListRow != null)
{
checkListRow.Answer = checkListRowDTO.Answer;
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckListRowDTO>(checkListRow);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public byte[] CreatePDF(int checkListHeaderId)
{
var location = System.Reflection.Assembly.GetEntryAssembly().Location;
@@ -23,6 +23,9 @@ namespace WorkFlowCheck.BL.Services.Interfaces
Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id);
Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO);
Task<CheckListRowDTO> GetCheckListRowAsync(int id);
Task<CheckListRowDTO> UpdateCheckListRowAsync(CheckListRowDTO checkListRowDTO);
byte[] CreatePDF(int checkListHeaderId);
}
}