CheckPoint -y CheckListTemplateRow

This commit is contained in:
2025-03-04 13:26:22 +01:00
parent 62dee24619
commit af607f6079
4 changed files with 16 additions and 8 deletions
@@ -22,9 +22,10 @@ namespace WorkFlowCheck.BL.Mappings
CreateMap<CheckListTemplateHeader, CheckListTemplateHeaderDTO>() CreateMap<CheckListTemplateHeader, CheckListTemplateHeaderDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows)); .ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckListTemplateRow, CheckListTemplateRowDTO>(); CreateMap<CheckListTemplateRow, CheckListTemplateRowDTO>();
CreateMap<CheckPoint, CheckPointDTO>(); CreateMap<CheckPoint, CheckPointDTO>().ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<Location, LocationDTO>(); CreateMap<Location, LocationDTO>();
CreateMap<Equipment, EquipmentDTO>(); CreateMap<Equipment, EquipmentDTO>();
CreateMap<CheckListHeader, CheckListHeaderDTO>() CreateMap<CheckListHeader, CheckListHeaderDTO>()
.ForMember(dest => dest.CheckListRowDTO, opt => opt.MapFrom(src => src.CheckListRows)); .ForMember(dest => dest.CheckListRowDTO, opt => opt.MapFrom(src => src.CheckListRows));
} }
+6 -3
View File
@@ -27,7 +27,10 @@ namespace WorkFlowCheck.BL.Services
try try
{ {
var res = await _dbContext.CheckPoints.ToListAsync(); var res = await _dbContext.CheckPoints
.Include(i => i.CheckListTemplateRows)
.AsNoTracking()
.ToListAsync();
if (res != null) if (res != null)
{ {
retVal = _mapper.Map<List<CheckPointDTO>>(res); retVal = _mapper.Map<List<CheckPointDTO>>(res);
@@ -89,7 +92,7 @@ namespace WorkFlowCheck.BL.Services
if (res != null) if (res != null)
{ {
retVal = _mapper.Map<List<CheckListTemplateHeaderDTO>>(res); retVal = _mapper.Map<List<CheckListTemplateHeaderDTO>>(res);
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -99,6 +102,6 @@ namespace WorkFlowCheck.BL.Services
return retVal; return retVal;
} }
} }
} }
@@ -1,10 +1,11 @@
namespace WorkFlowCheck.Common.DTO namespace WorkFlowCheck.Common.DTO
{ {
public class CheckPointDTO public class CheckPointDTO
{ {
public int Id { get; set; } public int Id { get; set; }
public string ShortName { get; set; } public string ShortName { get; set; }
public string Code { get; set; } public string Code { get; set; }
public List<CheckListTemplateRowDTO> CheckListTemplateRowDTO { get; set; } = new List<CheckListTemplateRowDTO>();
} }
} }
@@ -17,5 +17,8 @@ namespace WorkFlowCheck.DL.Entities
public string LastModBy { get; set; } = null!; public string LastModBy { get; set; } = null!;
public DateTime CreatedAt { get; set; } public DateTime CreatedAt { get; set; }
public string CreatedBy { get; set; } = null!; public string CreatedBy { get; set; } = null!;
public virtual ICollection<CheckListTemplateRow> CheckListTemplateRows { get; set; } = new List<CheckListTemplateRow>();
} }
} }