Equipment is kész.
This commit is contained in:
@@ -160,7 +160,7 @@ namespace WorkFlowCheck.BL.Services
|
||||
var res = await _dbContext.CheckListTemplateHeaders
|
||||
.Where(w => w.Id == Id)
|
||||
.Include(i => i.CheckListTemplateRows)
|
||||
.ThenInclude(i=> i.CheckPoint)
|
||||
.ThenInclude(i => i.CheckPoint)
|
||||
.Include(i => i.CheckListTemplateRows)
|
||||
.ThenInclude(i => i.Equipment)
|
||||
.AsNoTracking()
|
||||
@@ -210,7 +210,7 @@ namespace WorkFlowCheck.BL.Services
|
||||
{
|
||||
Description = checkListTemplateHeaderDTO.Description,
|
||||
ShortName = checkListTemplateHeaderDTO.ShortName,
|
||||
IsDeleted =false,
|
||||
IsDeleted = false,
|
||||
|
||||
};
|
||||
_dbContext.CheckListTemplateHeaders.Add(checkListTemplateHeader);
|
||||
@@ -226,7 +226,7 @@ namespace WorkFlowCheck.BL.Services
|
||||
if (checkListTemplateHeader != null)
|
||||
{
|
||||
checkListTemplateHeader.Description = checkListTemplateHeaderDTO.Description;
|
||||
checkListTemplateHeader.ShortName = checkListTemplateHeaderDTO.ShortName;
|
||||
checkListTemplateHeader.ShortName = checkListTemplateHeaderDTO.ShortName;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
retVal = _mapper.Map<CheckListTemplateHeaderDTO>(checkListTemplateHeader);
|
||||
@@ -247,8 +247,8 @@ namespace WorkFlowCheck.BL.Services
|
||||
try
|
||||
{
|
||||
var res = await _dbContext.CheckListTemplateRows
|
||||
.Include(i=> i.Equipment)
|
||||
.Include(i=> i.CheckPoint)
|
||||
.Include(i => i.Equipment)
|
||||
.Include(i => i.CheckPoint)
|
||||
.Where(w => w.Id == id)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefaultAsync();
|
||||
@@ -266,6 +266,52 @@ namespace WorkFlowCheck.BL.Services
|
||||
|
||||
return retVal;
|
||||
}
|
||||
public Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO) => throw new NotImplementedException();
|
||||
public async Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO)
|
||||
{
|
||||
var retVal = new CheckListTemplateRowDTO() { };
|
||||
try
|
||||
{
|
||||
if (checkListTemplateRowDTO.Id == 0)
|
||||
{
|
||||
var checkListTemplateRow = new CheckListTemplateRow()
|
||||
{
|
||||
CheckListTemplateHeaderId = checkListTemplateRowDTO.CheckListTemplateHeaderId,
|
||||
CheckPointId = checkListTemplateRowDTO.CheckPointId,
|
||||
EquipmentId = checkListTemplateRowDTO.EquipmentId,
|
||||
OperationDescription = checkListTemplateRowDTO.OperationDescription,
|
||||
AnswerType = checkListTemplateRowDTO.AnswerType,
|
||||
RowIndex = checkListTemplateRowDTO.RowIndex,
|
||||
|
||||
};
|
||||
_dbContext.CheckListTemplateRows.Add(checkListTemplateRow);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
retVal = _mapper.Map<CheckListTemplateRowDTO>(checkListTemplateRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
var checkListTemplateRow = await _dbContext.CheckListTemplateRows
|
||||
.Where(w => w.Id == checkListTemplateRowDTO.Id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (checkListTemplateRow != null)
|
||||
{
|
||||
checkListTemplateRow.CheckListTemplateHeaderId = checkListTemplateRowDTO.CheckListTemplateHeaderId;
|
||||
checkListTemplateRow.CheckPointId = checkListTemplateRowDTO.CheckPointId;
|
||||
checkListTemplateRow.EquipmentId = checkListTemplateRowDTO.EquipmentId;
|
||||
checkListTemplateRow.OperationDescription = checkListTemplateRowDTO.OperationDescription;
|
||||
checkListTemplateRow.AnswerType = checkListTemplateRowDTO.AnswerType;
|
||||
checkListTemplateRow.RowIndex = checkListTemplateRowDTO.RowIndex;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
retVal = _mapper.Map<CheckListTemplateRowDTO>(checkListTemplateRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user