CheckListRow edit
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user